ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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...
 
 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.

36 {
37 $this->check($data);
38 $this->data = $data;
39 }

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

+ 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.

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

References Vendor\Package\$a, and ILIAS\Setup\Artifact\ArrayArtifact\check().

Referenced by ILIAS\Setup\Artifact\ArrayArtifact\__construct(), and ILIAS\Setup\Artifact\ArrayArtifact\check().

+ Here is the call graph for this function:
+ 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: