19declare(strict_types=1);
21require_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);
130 new ReflectionClass(
"\\$class_name") :
131 new ReflectionClass($class_name)
142 if (in_array(ilCtrlBaseClassInterface::class, $reflection->getInterfaceNames(),
true)) {
143 $base_classes[] = $lower_class_name;
145 }
catch (ReflectionException
$e) {
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);
235 private function getParents(ReflectionClass $reflection): array
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,
'\\'));
$structure
TOTAL STRUCTURE.
Class ilCtrlStructureCidGenerator.
Class ilCtrlStructureHelper.
Class ilCtrlStructureReader is responsible for reading ilCtrl's control structure.
isExecuted()
Returns whether this instance was already executed or not.
__construct(ilCtrlIteratorInterface $iterator, ilCtrlStructureCidGenerator $cid_generator)
ilCtrlStructureReader Constructor
isNamespaced(string $class_name)
Returns if the given classname is namespaced.
getReferencedClassesByReflection(ReflectionClass $reflection, string $regex)
Returns all classes referenced by an ilCtrl_Calls or ilCtrl_isCalledBy statement.
getChildren(ReflectionClass $reflection)
Helper function that returns all children references.
ilCtrlIteratorInterface $iterator
getRelativePath(string $absolute_path)
Returns a given path relative to the ILIAS absolute path.
isGuiClass(string $path)
Returns whether the given file/path matches ILIAS conventions.
readStructure()
Processes all classes within the ILIAS installation.
const REGEX_GUI_CLASS_NAME
const REGEX_PHPDOC_CALLED_BYS
getParents(ReflectionClass $reflection)
Helper function that returns all parent references.
ilCtrlStructureCidGenerator $cid_generator
stripWhitespaces(string $string)
Helper function that replaces all whitespace characters from the given string.
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.