ILIAS  trunk Revision v11.0_alpha-2658-ge2404539063
ILIAS\MetaData\Vocabularies\Slots\ElementHelper Class Reference
+ Inheritance diagram for ILIAS\MetaData\Vocabularies\Slots\ElementHelper:
+ Collaboration diagram for ILIAS\MetaData\Vocabularies\Slots\ElementHelper:

Public Member Functions

 __construct (HandlerInterface $slot_handler, PathFactory $path_factory, NavigatorFactoryInterface $navigator_factory, ConditionChecker $condition_checker)
 
 slotForElement (ElementInterface $element)
 
 slotsForElementWithoutCondition (ElementInterface $element)
 
 potentialSlotForElementByCondition (ElementInterface $element, ElementInterface $element_in_condition, string $value)
 
 findElementOfCondition (Identifier $slot, ElementInterface $element, ElementInterface ... $all_elements)
 

Protected Attributes

HandlerInterface $slot_handler
 
PathFactory $path_factory
 
NavigatorFactoryInterface $navigator_factory
 
ConditionChecker $condition_checker
 

Detailed Description

Definition at line 28 of file ElementHelper.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MetaData\Vocabularies\Slots\ElementHelper::__construct ( HandlerInterface  $slot_handler,
PathFactory  $path_factory,
NavigatorFactoryInterface  $navigator_factory,
ConditionChecker  $condition_checker 
)

Member Function Documentation

◆ findElementOfCondition()

ILIAS\MetaData\Vocabularies\Slots\ElementHelper::findElementOfCondition ( Identifier  $slot,
ElementInterface  $element,
ElementInterface ...  $all_elements 
)

Implements ILIAS\MetaData\Vocabularies\Slots\ElementHelperInterface.

Definition at line 77 of file ElementHelper.php.

References null.

81  : ?ElementInterface {
82  if (!$this->slot_handler->isSlotConditional($slot)) {
83  return null;
84  }
85 
86  $condition_path = $this->slot_handler->conditionForSlot($slot)->path();
87  $potential_result = $this->navigator_factory->navigator($condition_path, $element)
88  ->lastElementAtFinalStep();
89 
90  return in_array($potential_result, $all_elements, true) ? $potential_result : null;
91  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ potentialSlotForElementByCondition()

ILIAS\MetaData\Vocabularies\Slots\ElementHelper::potentialSlotForElementByCondition ( ElementInterface  $element,
ElementInterface  $element_in_condition,
string  $value 
)

Implements ILIAS\MetaData\Vocabularies\Slots\ElementHelperInterface.

Definition at line 65 of file ElementHelper.php.

69  : Identifier {
70  return $this->slot_handler->identiferFromPathAndCondition(
71  $this->path_factory->toElement($element),
72  $this->path_factory->betweenElements($element, $element_in_condition),
73  $value,
74  );
75  }

◆ slotForElement()

ILIAS\MetaData\Vocabularies\Slots\ElementHelper::slotForElement ( ElementInterface  $element)

Implements ILIAS\MetaData\Vocabularies\Slots\ElementHelperInterface.

Definition at line 47 of file ElementHelper.php.

References ILIAS\Data\Description\NULL, and ILIAS\MetaData\Vocabularies\Slots\ElementHelper\slotsForElementWithoutCondition().

47  : Identifier
48  {
49  foreach ($this->slotsForElementWithoutCondition($element) as $slot) {
50  if ($this->condition_checker->doesElementFitSlot($element, $slot)) {
51  return $slot;
52  }
53  }
54  return Identifier::NULL;
55  }
slotsForElementWithoutCondition(ElementInterface $element)
+ Here is the call graph for this function:

◆ slotsForElementWithoutCondition()

ILIAS\MetaData\Vocabularies\Slots\ElementHelper::slotsForElementWithoutCondition ( ElementInterface  $element)
Returns
Identifier[]

Implements ILIAS\MetaData\Vocabularies\Slots\ElementHelperInterface.

Definition at line 60 of file ElementHelper.php.

References ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from().

Referenced by ILIAS\MetaData\Vocabularies\Slots\ElementHelper\slotForElement().

60  : \Generator
61  {
62  yield from $this->slot_handler->allSlotsForPath($this->path_factory->toElement($element));
63  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $condition_checker

ConditionChecker ILIAS\MetaData\Vocabularies\Slots\ElementHelper::$condition_checker
protected

◆ $navigator_factory

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

◆ $path_factory

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

◆ $slot_handler

HandlerInterface ILIAS\MetaData\Vocabularies\Slots\ElementHelper::$slot_handler
protected

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