ILIAS  release_7 Revision v7.30-3-g800a261c036
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

 $data = []
 

Detailed Description

An array as an artifact.

Definition at line 12 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 22 of file ArrayArtifact.php.

23 {
24 $this->check($data);
25 $this->data = $data;
26 }

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 34 of file ArrayArtifact.php.

35 {
36 foreach ($a as $item) {
37 if (is_string($item) || is_int($item) || is_float($item) || is_bool($item) || is_null($item)) {
38 continue;
39 }
40 if (is_array($item)) {
41 $this->check($item);
42 continue;
43 }
44 throw new \InvalidArgumentException(
45 "Array data for artifact may only contain ints, strings, floats, bools or " .
46 "other arrays with this content. Found: " . gettype($item)
47 );
48 }
49 }
$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 29 of file ArrayArtifact.php.

29 : string
30 {
31 return "<?" . "php return " . var_export($this->data, true) . ";";
32 }

Field Documentation

◆ $data

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

Definition at line 17 of file ArrayArtifact.php.

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


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