ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\MetaData\Vocabularies\Slots\Handler Class Reference
+ Inheritance diagram for ILIAS\MetaData\Vocabularies\Slots\Handler:
+ Collaboration diagram for ILIAS\MetaData\Vocabularies\Slots\Handler:

Public Member Functions

 __construct (PathFactory $path_factory, NavigatorFactoryInterface $navigator_factory, StructureSetInterface $structure)
 
 pathForSlot (Identifier $identifier)
 
 isSlotConditional (Identifier $identifier)
 
 conditionForSlot (Identifier $identifier)
 
 identiferFromPathAndCondition (PathInterface $path_to_element, ?PathInterface $path_to_condition, ?string $condition_value)
 
 allSlotsForPath (PathInterface $path_to_element)
 
 doesSlotExist (PathInterface $path_to_element, ?PathInterface $path_to_condition, ?string $condition_value)
 
 dataTypeForSlot (Identifier $identifier)
 
 pathForSlot (Identifier $identifier)
 
 isSlotConditional (Identifier $identifier)
 
 conditionForSlot (Identifier $identifier)
 
 identiferFromPathAndCondition (PathInterface $path_to_element, ?PathInterface $path_to_condition, ?string $condition_value)
 
 allSlotsForPath (PathInterface $path_to_element)
 
 doesSlotExist (PathInterface $path_to_element, ?PathInterface $path_to_condition, ?string $condition_value)
 
 dataTypeForSlot (Identifier $identifier)
 

Protected Member Functions

 buildPath (string ... $steps)
 
 buildCondition (string $condition_value, string|StepToken ... $steps_to_condition,)
 

Protected Attributes

PathFactory $path_factory
 
NavigatorFactoryInterface $navigator_factory
 
StructureSetInterface $structure
 
array $paths_by_slot_id = []
 
array $identifiers_by_path
 

Detailed Description

Definition at line 32 of file Handler.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MetaData\Vocabularies\Slots\Handler::__construct ( PathFactory  $path_factory,
NavigatorFactoryInterface  $navigator_factory,
StructureSetInterface  $structure 
)

Member Function Documentation

◆ allSlotsForPath()

ILIAS\MetaData\Vocabularies\Slots\Handler::allSlotsForPath ( PathInterface  $path_to_element)
Returns
Identifier[]

Implements ILIAS\MetaData\Vocabularies\Slots\HandlerInterface.

Definition at line 154 of file Handler.php.

154 : \Generator
155 {
156 if (!isset($this->identifiers_by_path)) {
157 $this->identifiers_by_path = [];
158 foreach (Identifier::cases() as $identifier) {
159 $path_for_slot = $this->pathForSlot($identifier);
160 $this->identifiers_by_path[$path_for_slot->toString()][] = $identifier;
161 }
162 }
163 yield from $this->identifiers_by_path[$path_to_element->toString()] ?? [];
164 }
pathForSlot(Identifier $identifier)
Definition: Handler.php:58

References ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from(), and ILIAS\MetaData\Paths\PathInterface\toString().

+ Here is the call graph for this function:

◆ buildCondition()

ILIAS\MetaData\Vocabularies\Slots\Handler::buildCondition ( string  $condition_value,
string|StepToken ...  $steps_to_condition 
)
protected

Definition at line 188 of file Handler.php.

191 : ConditionInterface {
192 $builder = $this->path_factory->custom();
193 foreach ($steps_to_condition as $step) {
194 if ($step === StepToken::SUPER) {
195 $builder = $builder->withNextStepToSuperElement();
196 continue;
197 }
198 $builder = $builder->withNextStep($step);
199 }
200 $path = $builder->withRelative(true)->get();
201
202 return new Condition(
203 $condition_value,
204 $path
205 );
206 }
$path
Definition: ltiservices.php:30

References ILIAS\MetaData\Paths\Steps\SUPER.

Referenced by ILIAS\MetaData\Vocabularies\Slots\Handler\conditionForSlot().

+ Here is the caller graph for this function:

◆ buildPath()

ILIAS\MetaData\Vocabularies\Slots\Handler::buildPath ( string ...  $steps)
protected

Definition at line 179 of file Handler.php.

179 : PathInterface
180 {
181 $builder = $this->path_factory->custom();
182 foreach ($steps as $step) {
183 $builder = $builder->withNextStep($step);
184 }
185 return $builder->get();
186 }

Referenced by ILIAS\MetaData\Vocabularies\Slots\Handler\pathForSlot().

+ Here is the caller graph for this function:

◆ conditionForSlot()

ILIAS\MetaData\Vocabularies\Slots\Handler::conditionForSlot ( Identifier  $identifier)

Implements ILIAS\MetaData\Vocabularies\Slots\HandlerInterface.

Definition at line 104 of file Handler.php.

104 : ?ConditionInterface
105 {
106 return match ($identifier) {
107 Identifier::LIFECYCLE_CONTRIBUTE_PUBLISHER => $this->buildCondition(
108 'publisher',
110 'role',
111 'value'
112 ),
113 Identifier::TECHNICAL_REQUIREMENT_BROWSER => $this->buildCondition(
114 'browser',
117 'type',
118 'value'
119 ),
120 Identifier::TECHNICAL_REQUIREMENT_OS => $this->buildCondition(
121 'operating system',
124 'type',
125 'value'
126 ),
127 default => null
128 };
129 }
buildCondition(string $condition_value, string|StepToken ... $steps_to_condition,)
Definition: Handler.php:188

References ILIAS\MetaData\Vocabularies\Slots\Handler\buildCondition(), and ILIAS\MetaData\Paths\Steps\SUPER.

Referenced by ILIAS\MetaData\Vocabularies\Slots\Handler\identiferFromPathAndCondition(), and ILIAS\MetaData\Vocabularies\Slots\Handler\isSlotConditional().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dataTypeForSlot()

ILIAS\MetaData\Vocabularies\Slots\Handler::dataTypeForSlot ( Identifier  $identifier)

Implements ILIAS\MetaData\Vocabularies\Slots\HandlerInterface.

Definition at line 208 of file Handler.php.

208 : DataType
209 {
210 return $this->navigator_factory->structureNavigator(
211 $this->pathForSlot($identifier),
212 $this->structure->getRoot()
213 )->elementAtFinalStep()->getDefinition()->dataType();
214 }

◆ doesSlotExist()

ILIAS\MetaData\Vocabularies\Slots\Handler::doesSlotExist ( PathInterface  $path_to_element,
?PathInterface  $path_to_condition,
?string  $condition_value 
)

Implements ILIAS\MetaData\Vocabularies\Slots\HandlerInterface.

Definition at line 166 of file Handler.php.

170 : bool {
171 $identifier = $this->identiferFromPathAndCondition(
172 $path_to_element,
173 $path_to_condition,
174 $condition_value
175 );
176 return $identifier !== Identifier::NULL;
177 }
identiferFromPathAndCondition(PathInterface $path_to_element, ?PathInterface $path_to_condition, ?string $condition_value)
Definition: Handler.php:131

◆ identiferFromPathAndCondition()

ILIAS\MetaData\Vocabularies\Slots\Handler::identiferFromPathAndCondition ( PathInterface  $path_to_element,
?PathInterface  $path_to_condition,
?string  $condition_value 
)

Implements ILIAS\MetaData\Vocabularies\Slots\HandlerInterface.

Definition at line 131 of file Handler.php.

135 : Identifier {
136 foreach (Identifier::cases() as $identifier) {
137 if ($this->pathForSlot($identifier)->toString() !== $path_to_element->toString()) {
138 continue;
139 }
140
141 $condition = $this->conditionForSlot($identifier);
142 if (
143 $condition?->value() !== $condition_value ||
144 $condition?->path()?->toString() !== $path_to_condition?->toString()
145 ) {
146 continue;
147 }
148
149 return $identifier;
150 }
151 return Identifier::NULL;
152 }
conditionForSlot(Identifier $identifier)
Definition: Handler.php:104

References ILIAS\MetaData\Vocabularies\Slots\Handler\conditionForSlot(), ILIAS\MetaData\Vocabularies\Slots\Handler\pathForSlot(), ILIAS\Export\ImportHandler\File\XML\Manifest\toString, and ILIAS\MetaData\Paths\PathInterface\toString().

+ Here is the call graph for this function:

◆ isSlotConditional()

ILIAS\MetaData\Vocabularies\Slots\Handler::isSlotConditional ( Identifier  $identifier)

Implements ILIAS\MetaData\Vocabularies\Slots\HandlerInterface.

Definition at line 99 of file Handler.php.

99 : bool
100 {
101 return !is_null($this->conditionForSlot($identifier));
102 }

References ILIAS\MetaData\Vocabularies\Slots\Handler\conditionForSlot().

+ Here is the call graph for this function:

◆ pathForSlot()

ILIAS\MetaData\Vocabularies\Slots\Handler::pathForSlot ( Identifier  $identifier)

Implements ILIAS\MetaData\Vocabularies\Slots\HandlerInterface.

Definition at line 58 of file Handler.php.

58 : PathInterface
59 {
60 if (isset($this->paths_by_slot_id[$identifier->value])) {
61 return $this->paths_by_slot_id[$identifier->value];
62 }
63 return $this->paths_by_slot_id[$identifier->value] = match ($identifier) {
64 Identifier::GENERAL_STRUCTURE => $this->buildPath('general', 'structure', 'value'),
65 Identifier::GENERAL_AGGREGATION_LEVEL => $this->buildPath('general', 'aggregationLevel', 'value'),
66 Identifier::GENERAL_COVERAGE => $this->buildPath('general', 'coverage', 'string'),
67 Identifier::GENERAL_IDENTIFIER_CATALOG => $this->buildPath('general', 'identifier', 'catalog'),
68 Identifier::LIFECYCLE_STATUS => $this->buildPath('lifeCycle', 'status', 'value'),
69 Identifier::LIFECYCLE_CONTRIBUTE_ROLE => $this->buildPath('lifeCycle', 'contribute', 'role', 'value'),
70 Identifier::LIFECYCLE_CONTRIBUTE_PUBLISHER => $this->buildPath('lifeCycle', 'contribute', 'entity'),
71 Identifier::METAMETADATA_IDENTIFIER_CATALOG => $this->buildPath('metaMetadata', 'identifier', 'catalog'),
72 Identifier::METAMETADATA_CONTRIBUTE_ROLE => $this->buildPath('metaMetadata', 'contribute', 'role', 'value'),
73 Identifier::METAMETADATA_SCHEMA => $this->buildPath('metaMetadata', 'metadataSchema'),
74 Identifier::TECHNICAL_REQUIREMENT_TYPE => $this->buildPath('technical', 'requirement', 'orComposite', 'type', 'value'),
75 Identifier::TECHNICAL_REQUIREMENT_BROWSER, Identifier::TECHNICAL_REQUIREMENT_OS => $this->buildPath('technical', 'requirement', 'orComposite', 'name', 'value'),
76 Identifier::TECHNICAL_OTHER_PLATFORM_REQUIREMENTS => $this->buildPath('technical', 'otherPlatformRequirements', 'string'),
77 Identifier::TECHNICAL_FORMAT => $this->buildPath('technical', 'format'),
78 Identifier::EDUCATIONAL_INTERACTIVITY_TYPE => $this->buildPath('educational', 'interactivityType', 'value'),
79 Identifier::EDUCATIONAL_LEARNING_RESOURCE_TYPE => $this->buildPath('educational', 'learningResourceType', 'value'),
80 Identifier::EDUCATIONAL_INTERACTIVITY_LEVEL => $this->buildPath('educational', 'interactivityLevel', 'value'),
81 Identifier::EDUCATIONAL_SEMANTIC_DENSITY => $this->buildPath('educational', 'semanticDensity', 'value'),
82 Identifier::EDCUCATIONAL_INTENDED_END_USER_ROLE => $this->buildPath('educational', 'intendedEndUserRole', 'value'),
83 Identifier::EDUCATIONAL_CONTEXT => $this->buildPath('educational', 'context', 'value'),
84 Identifier::EDUCATIONAL_DIFFICULTY => $this->buildPath('educational', 'difficulty', 'value'),
85 Identifier::EDUCATIONAL_TYPICAL_AGE_RANGE => $this->buildPath('educational', 'typicalAgeRange', 'string'),
86 Identifier::RIGHTS_COST => $this->buildPath('rights', 'cost', 'value'),
87 Identifier::RIGHTS_CP_AND_OTHER_RESTRICTIONS => $this->buildPath('rights', 'copyrightAndOtherRestrictions', 'value'),
88 Identifier::RIGHTS_DESCRIPTION => $this->buildPath('rights', 'description', 'string'),
89 Identifier::RELATION_KIND => $this->buildPath('relation', 'kind', 'value'),
90 Identifier::RELATION_RESOURCE_IDENTIFIER_CATALOG => $this->buildPath('relation', 'resource', 'identifier', 'catalog'),
91 Identifier::CLASSIFICATION_PURPOSE => $this->buildPath('classification', 'purpose', 'value'),
92 Identifier::CLASSIFICATION_KEYWORD => $this->buildPath('classification', 'keyword', 'string'),
93 Identifier::CLASSIFICATION_TAXPATH_SOURCE => $this->buildPath('classification', 'taxonPath', 'source', 'string'),
94 Identifier::CLASSIFICATION_TAXON_ENTRY => $this->buildPath('classification', 'taxonPath', 'taxon', 'entry', 'string'),
95 Identifier::NULL => $this->buildPath()
96 };
97 }

References ILIAS\MetaData\Vocabularies\Slots\Handler\buildPath(), ILIAS\MetaData\Vocabularies\Slots\CLASSIFICATION_TAXON_ENTRY, and ILIAS\Data\Description\NULL.

Referenced by ILIAS\MetaData\Vocabularies\Slots\Handler\identiferFromPathAndCondition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $identifiers_by_path

array ILIAS\MetaData\Vocabularies\Slots\Handler::$identifiers_by_path
protected

Definition at line 46 of file Handler.php.

◆ $navigator_factory

NavigatorFactoryInterface ILIAS\MetaData\Vocabularies\Slots\Handler::$navigator_factory
protected

Definition at line 35 of file Handler.php.

Referenced by ILIAS\MetaData\Vocabularies\Slots\Handler\__construct().

◆ $path_factory

PathFactory ILIAS\MetaData\Vocabularies\Slots\Handler::$path_factory
protected

Definition at line 34 of file Handler.php.

Referenced by ILIAS\MetaData\Vocabularies\Slots\Handler\__construct().

◆ $paths_by_slot_id

array ILIAS\MetaData\Vocabularies\Slots\Handler::$paths_by_slot_id = []
protected

Definition at line 41 of file Handler.php.

◆ $structure

StructureSetInterface ILIAS\MetaData\Vocabularies\Slots\Handler::$structure
protected

Definition at line 36 of file Handler.php.

Referenced by ILIAS\MetaData\Vocabularies\Slots\Handler\__construct().


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