ILIAS  release_7 Revision v7.30-3-g800a261c036
ilCtrlStructure Class Reference

The CtrlStructure knows how GUIs call each other and where the code of the guis is located. More...

+ Collaboration diagram for ilCtrlStructure:

Public Member Functions

 __construct (array $class_scripts=[], array $class_children=[])
 
 withClassScript (string $class, string $file_path)
 
 withClassChild (string $parent, string $child)
 
 getClassScripts ()
 
 getClassChildren ()
 
 getClassScriptOf (string $class)
 

Protected Member Functions

 addClassScript (string $class, string $file_path)
 
 addClassChild (string $parent, string $child)
 

Protected Attributes

 $class_scripts
 
 $class_children
 

Detailed Description

The CtrlStructure knows how GUIs call each other and where the code of the guis is located.

Definition at line 8 of file class.ilCtrlStructure.php.

Constructor & Destructor Documentation

◆ __construct()

ilCtrlStructure::__construct ( array  $class_scripts = [],
array  $class_children = [] 
)

Definition at line 20 of file class.ilCtrlStructure.php.

References $class_children, $class_scripts, addClassChild(), and addClassScript().

21  {
22  $this->class_scripts = [];
23  $this->class_children = [];
24  foreach ($class_scripts as $k => $v) {
25  $this->addClassScript($k, $v);
26  }
27  foreach ($class_children as $k => $vs) {
28  foreach ($vs as $v) {
29  $this->addClassChild($k, $v);
30  }
31  }
32  }
addClassChild(string $parent, string $child)
addClassScript(string $class, string $file_path)
+ Here is the call graph for this function:

Member Function Documentation

◆ addClassChild()

ilCtrlStructure::addClassChild ( string  $parent,
string  $child 
)
protected

Definition at line 90 of file class.ilCtrlStructure.php.

Referenced by __construct(), and withClassChild().

90  : void
91  {
92  if ($parent == "") {
93  throw new \InvalidArgumentException(
94  "Can't add class child for an empty parent."
95  );
96  }
97 
98  if (!isset($this->class_children[$parent])) {
99  $this->class_children[$parent] = [];
100  }
101 
102  if (!in_array($child, $this->class_children[$parent])) {
103  $this->class_children[$parent][] = $child;
104  }
105  }
+ Here is the caller graph for this function:

◆ addClassScript()

ilCtrlStructure::addClassScript ( string  $class,
string  $file_path 
)
protected

Definition at line 70 of file class.ilCtrlStructure.php.

References Vendor\Package\$e.

Referenced by __construct(), and withClassScript().

70  : void
71  {
72  if ($class == "") {
73  throw new \InvalidArgumentException(
74  "Can't add class script for an empty class."
75  );
76  }
77 
78  if (isset($this->class_scripts[$class]) && $this->class_scripts[$class] != $file_path) {
79  $e = new \RuntimeException(
80  "Can't add script '$file_path' for class '$class', a script for that class already exists."
81  );
82  $e->file_path = $file_path;
83  $e->class = $class;
84  throw $e;
85  }
86 
87  $this->class_scripts[$class] = $file_path;
88  }
+ Here is the caller graph for this function:

◆ getClassChildren()

ilCtrlStructure::getClassChildren ( )

Definition at line 55 of file class.ilCtrlStructure.php.

Referenced by ilCtrlStructureReader\storeToDB().

55  : \Generator
56  {
57  foreach ($this->class_children as $k => $v) {
58  yield $k => $v;
59  }
60  }
+ Here is the caller graph for this function:

◆ getClassScriptOf()

ilCtrlStructure::getClassScriptOf ( string  $class)

Definition at line 62 of file class.ilCtrlStructure.php.

Referenced by ilCtrlStructureReader\readDirTo().

62  : ?string
63  {
64  if (!isset($this->class_scripts[$class])) {
65  return null;
66  }
67  return $this->class_scripts[$class];
68  }
+ Here is the caller graph for this function:

◆ getClassScripts()

ilCtrlStructure::getClassScripts ( )

Definition at line 48 of file class.ilCtrlStructure.php.

Referenced by ilCtrlStructureReader\storeToDB().

48  : \Generator
49  {
50  foreach ($this->class_scripts as $k => $v) {
51  yield $k => $v;
52  }
53  }
+ Here is the caller graph for this function:

◆ withClassChild()

ilCtrlStructure::withClassChild ( string  $parent,
string  $child 
)

Definition at line 41 of file class.ilCtrlStructure.php.

References addClassChild().

Referenced by ilCtrlStructureReader\parseFileTo().

42  {
43  $clone = clone $this;
44  $clone->addClassChild($parent, $child);
45  return $clone;
46  }
addClassChild(string $parent, string $child)
The CtrlStructure knows how GUIs call each other and where the code of the guis is located...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ withClassScript()

ilCtrlStructure::withClassScript ( string  $class,
string  $file_path 
)

Definition at line 34 of file class.ilCtrlStructure.php.

References addClassScript().

Referenced by ilCtrlStructureReader\parseFileTo().

35  {
36  $clone = clone $this;
37  $clone->addClassScript($class, $file_path);
38  return $clone;
39  }
The CtrlStructure knows how GUIs call each other and where the code of the guis is located...
addClassScript(string $class, string $file_path)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $class_children

ilCtrlStructure::$class_children
protected

Definition at line 18 of file class.ilCtrlStructure.php.

Referenced by __construct().

◆ $class_scripts

ilCtrlStructure::$class_scripts
protected

Definition at line 13 of file class.ilCtrlStructure.php.

Referenced by __construct().


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