ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\MetaData\Structure\Definitions\LOMReader Class Reference
+ Inheritance diagram for ILIAS\MetaData\Structure\Definitions\LOMReader:
+ Collaboration diagram for ILIAS\MetaData\Structure\Definitions\LOMReader:

Public Member Functions

 __construct (int $depth=0, ?array $definition_array=null)
 
 definition ()
 
 subDefinitions ()
 

Protected Member Functions

 getDefinitionArray ()
 
 name ()
 
 unique ()
 
 dataType ()
 
 throwStructureException (string $error)
 

Protected Attributes

array $definition_array
 
int $depth = 0
 

Detailed Description

Definition at line 25 of file LOMReader.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MetaData\Structure\Definitions\LOMReader::__construct ( int  $depth = 0,
?array  $definition_array = null 
)

Definition at line 30 of file LOMReader.php.

References ILIAS\MetaData\Structure\Definitions\LOMReader\$definition_array, ILIAS\MetaData\Structure\Definitions\LOMReader\$depth, and ILIAS\MetaData\Structure\Definitions\LOMReader\getDefinitionArray().

33  {
34  if ($this->depth > 20) {
35  throw new \ilMDStructureException('LOM Structure is nested to deep.');
36  }
37  if (!is_null($definition_array)) {
38  $this->definition_array = $definition_array;
39  return;
40  }
41  $this->definition_array = $this->getDefinitionArray();
42  $this->depth = $depth;
43  }
+ Here is the call graph for this function:

Member Function Documentation

◆ dataType()

ILIAS\MetaData\Structure\Definitions\LOMReader::dataType ( )
protected

Definition at line 90 of file LOMReader.php.

References ILIAS\MetaData\Structure\Definitions\LOMReader\throwStructureException().

Referenced by ILIAS\MetaData\Structure\Definitions\LOMReader\definition().

90  : Type
91  {
92  if (
93  !isset($this->definition_array['type']) ||
94  is_null($type = $this->definition_array['type'])
95  ) {
96  $this->throwStructureException('invalid data type');
97  }
98  return $type;
99  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ definition()

ILIAS\MetaData\Structure\Definitions\LOMReader::definition ( )

◆ getDefinitionArray()

ILIAS\MetaData\Structure\Definitions\LOMReader::getDefinitionArray ( )
protected

Definition at line 45 of file LOMReader.php.

Referenced by ILIAS\MetaData\Structure\Definitions\LOMReader\__construct().

45  : array
46  {
47  return require(__DIR__ . "/../../../StructureDefinition/LOMStructure.php");
48  }
+ Here is the caller graph for this function:

◆ name()

ILIAS\MetaData\Structure\Definitions\LOMReader::name ( )
protected

Definition at line 74 of file LOMReader.php.

References ILIAS\MetaData\Structure\Definitions\LOMReader\throwStructureException().

Referenced by ILIAS\MetaData\Structure\Definitions\LOMReader\definition().

74  : string
75  {
76  if (!isset($this->definition_array['name'])) {
77  $this->throwStructureException('missing name');
78  }
79  return $this->definition_array['name'];
80  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ subDefinitions()

ILIAS\MetaData\Structure\Definitions\LOMReader::subDefinitions ( )
Returns
LOMReader[]

Implements ILIAS\MetaData\Structure\Definitions\ReaderInterface.

Definition at line 62 of file LOMReader.php.

62  : \Generator
63  {
64  $sub_definitions = $this->definition_array['sub'] ?? [];
65  foreach ($this->definition_array['sub'] as $sub_definition) {
66  $reader = new LOMReader(
67  $this->depth + 1,
68  $sub_definition
69  );
70  yield $reader;
71  }
72  }

◆ throwStructureException()

ILIAS\MetaData\Structure\Definitions\LOMReader::throwStructureException ( string  $error)
protected

Definition at line 101 of file LOMReader.php.

Referenced by ILIAS\MetaData\Structure\Definitions\LOMReader\dataType(), ILIAS\MetaData\Structure\Definitions\LOMReader\name(), and ILIAS\MetaData\Structure\Definitions\LOMReader\unique().

101  : void
102  {
103  throw new \ilMDStructureException(
104  'LOM definition is invalid:' . $error
105  );
106  }
ilErrorHandling $error
Definition: class.ilias.php:69
+ Here is the caller graph for this function:

◆ unique()

ILIAS\MetaData\Structure\Definitions\LOMReader::unique ( )
protected

Definition at line 82 of file LOMReader.php.

References ILIAS\MetaData\Structure\Definitions\LOMReader\throwStructureException().

Referenced by ILIAS\MetaData\Structure\Definitions\LOMReader\definition().

82  : bool
83  {
84  if (!isset($this->definition_array['unique'])) {
85  $this->throwStructureException('missing unique');
86  }
87  return (bool) $this->definition_array['unique'];
88  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $definition_array

array ILIAS\MetaData\Structure\Definitions\LOMReader::$definition_array
protected

◆ $depth

int ILIAS\MetaData\Structure\Definitions\LOMReader::$depth = 0
protected

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