ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Setup\AbstractOfFinder Class Reference
+ Inheritance diagram for ILIAS\Setup\AbstractOfFinder:
+ Collaboration diagram for ILIAS\Setup\AbstractOfFinder:

Public Member Functions

 __construct ()
 

Protected Member Functions

 genericGetMatchingClassNames (callable $is_matching, array $additional_ignore=[], ?string $matching_path=null)
 The matcher finds the class names implementing the given interface, while ignoring paths in self::$ignore and and the additional patterns provided. More...
 
 getAllClassNames (array $additional_ignore, ?string $matching_path=null)
 

Protected Attributes

string $root
 
array $ignore
 
array $classmap = null
 

Detailed Description

Definition at line 28 of file AbstractOfFinder.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Setup\AbstractOfFinder::__construct ( )

Definition at line 66 of file AbstractOfFinder.php.

References null.

67  {
68  $this->root = substr(__FILE__, 0, strpos(__FILE__, DIRECTORY_SEPARATOR . "components"));
69  $external_classmap = include(__DIR__ . "/../../../../vendor/composer/vendor/composer/autoload_classmap.php");
70  $this->classmap = $external_classmap ?: null;
71  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

Member Function Documentation

◆ genericGetMatchingClassNames()

ILIAS\Setup\AbstractOfFinder::genericGetMatchingClassNames ( callable  $is_matching,
array  $additional_ignore = [],
?string  $matching_path = null 
)
protected

The matcher finds the class names implementing the given interface, while ignoring paths in self::$ignore and and the additional patterns provided.

Patterns are regexps (without delimiters) to define complete paths on the filesystem to be ignored or selected.

Parameters
callable$is_matchingwhich takes a as argument and returns a bool if the class is matching your criteria.
string[]$additional_ignore
string | null$matching_path

Definition at line 86 of file AbstractOfFinder.php.

References Vendor\Package\$e, and ILIAS\Setup\AbstractOfFinder\getAllClassNames().

Referenced by ILIAS\Setup\UsageOfAttributeFinder\getMatchingClassNames(), ILIAS\Setup\ImplementationOfInterfaceFinder\getMatchingClassNames(), and ILIAS\Tests\Setup\TestAbstractOfFinder\getMatchingClassNames().

90  : \Iterator {
91  foreach ($this->getAllClassNames($additional_ignore, $matching_path) as $class_name) {
92  try {
93  $reflection_class = new \ReflectionClass($class_name);
94  if ($is_matching($reflection_class)) {
95  yield $class_name;
96  }
97  } catch (\Throwable $e) {
98  // ignore
99  }
100  }
101  }
getAllClassNames(array $additional_ignore, ?string $matching_path=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllClassNames()

ILIAS\Setup\AbstractOfFinder::getAllClassNames ( array  $additional_ignore,
?string  $matching_path = null 
)
protected
Parameters
string[]$additional_ignore

Definition at line 106 of file AbstractOfFinder.php.

References $path.

Referenced by ILIAS\Setup\AbstractOfFinder\genericGetMatchingClassNames().

106  : \Iterator
107  {
108  $ignore = array_merge($this->ignore, $additional_ignore);
109 
110  if (!is_array($this->classmap)) {
111  throw new \LogicException("Composer ClassMap not loaded");
112  }
113 
114  $regexp = implode(
115  "|",
116  array_map(
117  // fix path-separators to respect windows' backspaces.
118  fn($v): string => "(" . str_replace('/', '(/|\\\\)', $v) . ")",
119  $ignore
120  )
121  );
122  if ($matching_path) {
123  $matching_path = str_replace('/', '(/|\\\\)', $matching_path);
124  }
125 
126 
127  foreach ($this->classmap as $class_name => $file_path) {
128  $real_path = realpath($file_path);
129  if ($real_path === false) {
130  throw new \RuntimeException(
131  "Could not find file for class $class_name (path: $file_path). " .
132  "Please check the composer classmap, maybe it is outdated. " .
133  "You can regenerate it by executing 'composer du' or 'composer install' " .
134  "(which also ensures dependencies are correctly installed) in the ILIAS root directory."
135  );
136  }
137 
138  $path = str_replace($this->root, "", $real_path);
139  if ($matching_path && !preg_match("#^" . $matching_path . "$#", $path)) {
140  continue;
141  }
142  if (!preg_match("#^" . $regexp . "$#", $path)) {
143  yield $class_name;
144  }
145  }
146  }
$path
Definition: ltiservices.php:29
+ Here is the caller graph for this function:

Field Documentation

◆ $classmap

array ILIAS\Setup\AbstractOfFinder::$classmap = null
protected

Definition at line 64 of file AbstractOfFinder.php.

◆ $ignore

array ILIAS\Setup\AbstractOfFinder::$ignore
protected
Initial value:
= [
'.*/components/ILIAS/Setup/',
'.*/components/ILIAS/GlobalScreen/',
'.*/vendor/',
'.*/components/ILIAS/App/tests/',
'.*/components/ILIAS/BackgroundTasks/tests/',
'.*/components/ILIAS/Cache/tests/',
'.*/components/ILIAS/Data/tests/',
'.*/components/ILIAS/FileUpload/tests/',
'.*/components/ILIAS/Filesystem/tests/',
'.*/components/ILIAS/GlobalCache/tests/',
'.*/components/ILIAS/HTTP/tests/',
'.*/components/ILIAS/KioskMode/tests/',
'.*/components/ILIAS/Language/tests/',
'.*/components/ILIAS/Refinery/tests/',
'.*/components/ILIAS/ResourceStorage/tests/',
'.*/components/ILIAS/Types/tests/',
'.*/components/ILIAS/UI/tests/',
'.*/components/ILIAS/VirusScanner/tests/',
'.*/components/ILIAS/setup_/',
'.*ilSOAPAuth.*',
'.*ilPDExternalFeedBlockGUI.*',
]

Definition at line 35 of file AbstractOfFinder.php.

◆ $root

string ILIAS\Setup\AbstractOfFinder::$root
protected

Definition at line 30 of file AbstractOfFinder.php.


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