ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\Setup\ImplementationOfInterfaceFinder Class Reference
+ Collaboration diagram for ILIAS\Setup\ImplementationOfInterfaceFinder:

Public Member Functions

 __construct (string $interface)
 
 getMatchingClassNames ()
 

Private Member Functions

 getAllClassNames ()
 

Private Attributes

 $interface = ""
 
 $ignore
 

Detailed Description

Definition at line 10 of file ImplementationOfInterfaceFinder.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Setup\ImplementationOfInterfaceFinder::__construct ( string  $interface)

Member Function Documentation

◆ getAllClassNames()

ILIAS\Setup\ImplementationOfInterfaceFinder::getAllClassNames ( )
private

Definition at line 40 of file ImplementationOfInterfaceFinder.php.

References ILIAS\Setup\ImplementationOfInterfaceFinder\$ignore.

Referenced by ILIAS\Setup\ImplementationOfInterfaceFinder\__construct(), and ILIAS\Setup\ImplementationOfInterfaceFinder\getMatchingClassNames().

40  : \Iterator
41  {
42  // We use the composer classmap ATM
43  $composer_classmap = include "./libs/composer/vendor/composer/autoload_classmap.php";
44  $root = substr(__FILE__, 0, strpos(__FILE__, "/src"));
45 
46  if (!is_array($composer_classmap)) {
47  throw new \LogicException("Composer ClassMap not loaded");
48  }
49 
50  $regexp = implode(
51  "|",
52  array_map(
53  // fix path-separators to respect windows' backspaces.
54  function ($v) {
55  return "(" . str_replace('/', '(/|\\\\)', $v) . ")";
56  },
58  )
59  );
60 
61  foreach ($composer_classmap as $class_name => $file_path) {
62  $path = str_replace($root, "", realpath($file_path));
63  if (!preg_match("#^" . $regexp . "$#", $path)) {
64  yield $class_name;
65  }
66  }
67  }
+ Here is the caller graph for this function:

◆ getMatchingClassNames()

ILIAS\Setup\ImplementationOfInterfaceFinder::getMatchingClassNames ( )

Definition at line 70 of file ImplementationOfInterfaceFinder.php.

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

70  : \Iterator
71  {
72  foreach ($this->getAllClassNames() as $class_name) {
73  try {
74  $r = new \ReflectionClass($class_name);
75  if ($r->isInstantiable() && $r->implementsInterface($this->interface)) {
76  yield $class_name;
77  }
78  } catch (\Throwable $e) {
79  // noting to do here
80  }
81  }
82  }
+ Here is the call graph for this function:

Field Documentation

◆ $ignore

ILIAS\Setup\ImplementationOfInterfaceFinder::$ignore
private
Initial value:
= [
'.*/libs/',
'.*/test/',
'.*/tests/',
'.*/setup/',
'.*ilSOAPAuth.*',
'.*ilPDExternalFeedBlockGUI.*',
]

Definition at line 21 of file ImplementationOfInterfaceFinder.php.

Referenced by ILIAS\Setup\ImplementationOfInterfaceFinder\getAllClassNames().

◆ $interface

ILIAS\Setup\ImplementationOfInterfaceFinder::$interface = ""
private

Definition at line 16 of file ImplementationOfInterfaceFinder.php.


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