ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilCtrlStructureHelper Class Reference

Class ilCtrlStructureHelper. More...

+ Collaboration diagram for ilCtrlStructureHelper:

Public Member Functions

 __construct (array $base_classes, array $ctrl_structure)
 ilCtrlStructureHelper Constructor More...
 
 mapStructureReferences ()
 Fluent mapper method that adds vise-versa references for each entry in the current ctrl structure - e.g. More...
 
 filterUnnecessaryEntries ()
 Fluent filter method that removes structure entries, whose parent- and child-references are empty. More...
 
 getStructure ()
 Returns the current ctrl structure. More...
 

Protected Attributes

array $ctrl_structure
 
array $base_classes
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCtrlStructureHelper::__construct ( array  $base_classes,
array  $ctrl_structure 
)

ilCtrlStructureHelper Constructor

Parameters
array$base_classes
array$ctrl_structure

Definition at line 42 of file class.ilCtrlStructureHelper.php.

References $base_classes, and $ctrl_structure.

43  {
44  $this->ctrl_structure = $ctrl_structure;
45  $this->base_classes = $base_classes;
46  }

Member Function Documentation

◆ filterUnnecessaryEntries()

ilCtrlStructureHelper::filterUnnecessaryEntries ( )

Fluent filter method that removes structure entries, whose parent- and child-references are empty.

That means these classes are not considered necessary GUI classes. Such structure entries can be safely removed, because if they have neither children nor parents, they will never be called unless they are a baseclass itself.

Returns
self

Definition at line 76 of file class.ilCtrlStructureHelper.php.

References ilCtrlStructureInterface\KEY_CLASS_CHILDREN, and ilCtrlStructureInterface\KEY_CLASS_PARENTS.

76  : self
77  {
78  $this->ctrl_structure = array_filter(
79  $this->ctrl_structure,
80  function (array $value, string $key): bool {
81  // if the entry is not a baseclass and has no
82  // references, the entry will be removed.
83  return !(
84  !in_array($key, $this->base_classes, true) &&
87  );
88  },
89  ARRAY_FILTER_USE_BOTH
90  );
91 
92  return $this;
93  }

◆ getStructure()

ilCtrlStructureHelper::getStructure ( )

Returns the current ctrl structure.

Returns
array<string, mixed>

Definition at line 99 of file class.ilCtrlStructureHelper.php.

References $ctrl_structure.

Referenced by mapStructureReferences().

99  : array
100  {
101  return $this->ctrl_structure;
102  }
+ Here is the caller graph for this function:

◆ mapStructureReferences()

ilCtrlStructureHelper::mapStructureReferences ( )

Fluent mapper method that adds vise-versa references for each entry in the current ctrl structure - e.g.

if a class has several parent classes, this class is added as a child class to each parent, and vise-versa. This method doesn't necessarily need to be called, as it's performance heavy, but for example when reading the ctrl structure the mappings are wished to be complete.

Returns
self

Definition at line 58 of file class.ilCtrlStructureHelper.php.

References getStructure().

58  : self
59  {
60  $this->ctrl_structure = (new ilCtrlStructureMapper(
61  $this->ctrl_structure
62  ))->getStructure();
63 
64  return $this;
65  }
getStructure()
Returns the current ctrl structure.
Class ilCtrlStructureMapper.
+ Here is the call graph for this function:

Field Documentation

◆ $base_classes

array ilCtrlStructureHelper::$base_classes
protected

Definition at line 35 of file class.ilCtrlStructureHelper.php.

Referenced by __construct().

◆ $ctrl_structure

array ilCtrlStructureHelper::$ctrl_structure
protected

Definition at line 30 of file class.ilCtrlStructureHelper.php.

Referenced by __construct(), and getStructure().


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