3 declare(strict_types=1);
52 if (!empty($this->ctrl_structure[$class_name][$key_ref_from])) {
53 foreach ($this->ctrl_structure[$class_name][$key_ref_from] as
$index => $reference) {
54 $is_reference_available = isset($this->ctrl_structure[$reference]);
59 if ($is_reference_available && $is_reference_valid) {
61 if (!isset($this->ctrl_structure[$reference][$key_ref_to])) {
62 $this->ctrl_structure[$reference][$key_ref_to] = [];
66 if (!in_array($class_name, $this->ctrl_structure[$reference][$key_ref_to],
true)) {
67 $this->ctrl_structure[$reference][$key_ref_to][] = $class_name;
73 if (!$is_reference_available || !$is_reference_valid) {
85 if (!empty($this->ctrl_structure)) {
86 foreach ($this->ctrl_structure as $class_name =>
$data) {
101 unset($this->ctrl_structure[$class_name]);
117 unset($reference_list[
$index]);
120 $reference_list = array_values($reference_list);
138 if (!isset($this->ctrl_structure[
$index])) {
143 if (!is_array($this->ctrl_structure[$index])) {
mapStructure()
Maps the current structures references.
Class ilCtrlStructureMapper.
getStructure()
Returns the current structure with mapped vise-versa references of each parent-child relation...
removeReference(array &$reference_list, $index)
Removes an entry within the given reference list for the given index and re-indexes the reference lis...
isStructureEntryValid($index)
Helper function that returns whether an entry in the current structure is valid or not...
addViseVersaMappingByClass(string $class_name, string $key_ref_from, string $key_ref_to)
If a class has referenced another one as child or parent, this method adds a vise-versa mapping if it...
__construct(array $ctrl_structure)
ilCtrlStructureMapper Constructor