ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\Setup\ArrayArtifact Class Reference

An array as an artifact. More...

+ Inheritance diagram for ILIAS\Setup\ArrayArtifact:
+ Collaboration diagram for ILIAS\Setup\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

 $data = []
 

Detailed Description

An array as an artifact.

Definition at line 10 of file ArrayArtifact.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 20 of file ArrayArtifact.php.

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

21  {
22  $this->check($data);
23  $this->data = $data;
24  }
+ Here is the call graph for this function:

Member Function Documentation

◆ check()

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

Definition at line 32 of file ArrayArtifact.php.

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

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

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

Implements ILIAS\Setup\Artifact.

Definition at line 27 of file ArrayArtifact.php.

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

Field Documentation

◆ $data

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

Definition at line 15 of file ArrayArtifact.php.

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


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