19 declare(strict_types=1);
21 require_once __DIR__ .
'/../../../../../vendor/composer/vendor/autoload.php';
43 private const REGEX_PHPDOC_CALLS =
'/(((?i)@ilctrl_calls)\s*({CLASS_NAME}(:\s*|\s*:\s*))\K)([A-z0-9,\s])*/';
87 $this->ilias_path = rtrim(
88 (defined(
'ILIAS_ABSOLUTE_PATH')) ?
89 ILIAS_ABSOLUTE_PATH : dirname(__FILE__, 6),
115 foreach ($this->iterator as $class_name =>
$path) {
121 $lower_class_name = strtolower($class_name);
142 if (in_array(ilCtrlBaseClassInterface::class, $reflection->getInterfaceNames(),
true)) {
143 $base_classes[] = $lower_class_name;
151 ->mapStructureReferences()
152 ->filterUnnecessaryEntries()
156 $this->is_executed =
true;
158 return $mapped_structure;
172 if (!$reflection->getDocComment()) {
178 $name = str_replace(
'\\',
'\\\\', $reflection->getName());
179 $regex = str_replace(
'{CLASS_NAME}', $name, $regex);
180 preg_match_all($regex, $reflection->getDocComment(), $matches);
184 if (empty($matches[0])) {
188 $referenced_classes = [];
189 foreach ($matches[0] as $class_list) {
191 foreach (explode(
',', $class_list) as $class) {
193 if (!empty($class_name)) {
194 $referenced_classes[] = strtolower($class_name);
199 return $referenced_classes;
213 $absolute_path = realpath($absolute_path);
215 return '.' . str_replace($this->ilias_path,
'', $absolute_path);
249 return (
string) preg_replace(
'/\s+/',
'', $string);
260 return (
bool) preg_match(self::REGEX_GUI_CLASS_NAME, basename($path));
271 return (
false !== strpos($class_name,
'\\'));
readStructure()
Processes all classes within the ILIAS installation.
ilCtrlIteratorInterface $iterator
Class ilCtrlStructureHelper.
__construct(ilCtrlIteratorInterface $iterator, ilCtrlStructureCidGenerator $cid_generator)
ilCtrlStructureReader Constructor
Class ilCtrlStructureCidGenerator.
isNamespaced(string $class_name)
Returns if the given classname is namespaced.
const REGEX_GUI_CLASS_NAME
isExecuted()
Returns whether this instance was already executed or not.
stripWhitespaces(string $string)
Helper function that replaces all whitespace characters from the given string.
getReferencedClassesByReflection(ReflectionClass $reflection, string $regex)
Returns all classes referenced by an ilCtrl_Calls or ilCtrl_isCalledBy statement. ...
ilCtrlStructureCidGenerator $cid_generator
getChildren(ReflectionClass $reflection)
Helper function that returns all children references.
Class ilCtrlStructureReader is responsible for reading ilCtrl's control structure.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const KEY_CLASS_CID
array key constants that are used for certain information.
getRelativePath(string $absolute_path)
Returns a given path relative to the ILIAS absolute path.
$structure
TOTAL STRUCTURE.
const REGEX_PHPDOC_CALLED_BYS
getParents(ReflectionClass $reflection)
Helper function that returns all parent references.
isGuiClass(string $path)
Returns whether the given file/path matches ILIAS conventions.