ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\Setup\Artifact\ArrayArtifact Class Reference

An array as an artifact. More...

+ Inheritance diagram for ILIAS\Setup\Artifact\ArrayArtifact:
+ Collaboration diagram for ILIAS\Setup\Artifact\ArrayArtifact:

Public Member Functions

 __construct (array $data)
 
 serialize ()
 This method will be called from the source, which wants to save the artifact. More...
 

Private Member Functions

 check (array $a)
 

Private Attributes

array $data = []
 

Detailed Description

An array as an artifact.

Definition at line 28 of file ArrayArtifact.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Setup\Artifact\ArrayArtifact::__construct ( array  $data)
Parameters
array$data- may only contain primitive data

Definition at line 35 of file ArrayArtifact.php.

References ILIAS\Setup\Artifact\ArrayArtifact\$data, and ILIAS\Setup\Artifact\ArrayArtifact\check().

36  {
37  $this->check($data);
38  $this->data = $data;
39  }
+ Here is the call graph for this function:

Member Function Documentation

◆ check()

ILIAS\Setup\Artifact\ArrayArtifact::check ( array  $a)
private

Definition at line 47 of file ArrayArtifact.php.

Referenced by ILIAS\Setup\Artifact\ArrayArtifact\__construct().

47  : void
48  {
49  foreach ($a as $item) {
50  if (is_string($item) || is_int($item) || is_float($item) || is_bool($item) || is_null($item)) {
51  continue;
52  }
53  if (is_array($item)) {
54  $this->check($item);
55  continue;
56  }
57  throw new \InvalidArgumentException(
58  "Array data for artifact may only contain ints, strings, floats, bools or " .
59  "other arrays with this content. Found: " . gettype($item)
60  );
61  }
62  }
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
+ Here is the caller graph for this function:

◆ serialize()

ILIAS\Setup\Artifact\ArrayArtifact::serialize ( )
final

This method will be called from the source, which wants to save the artifact.

Implements ILIAS\Setup\Artifact.

Definition at line 42 of file ArrayArtifact.php.

42  : string
43  {
44  return "<?" . "php return " . var_export($this->data, true) . ";";
45  }

Field Documentation

◆ $data

array ILIAS\Setup\Artifact\ArrayArtifact::$data = []
private

Definition at line 30 of file ArrayArtifact.php.

Referenced by ILIAS\Setup\Artifact\ArrayArtifact\__construct().


The documentation for this class was generated from the following file: