Conditions | 5 |
Paths | 9 |
Total Lines | 24 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
39 | private function findClassesInPaths(array $searchPaths): array |
||
40 | { |
||
41 | $finder = new Finder(); |
||
42 | $includedFiles = []; |
||
43 | foreach ($searchPaths as $path) { |
||
44 | /** @var \SplFileInfo[] $files */ |
||
45 | $files = $finder->files()->name('*.php')->in($path); |
||
46 | foreach ($files as $file) { |
||
47 | require_once $file->getRealPath(); |
||
48 | $includedFiles[] = $file->getRealPath(); |
||
49 | } |
||
50 | } |
||
51 | |||
52 | $declared = get_declared_classes(); |
||
53 | |||
54 | $classes = []; |
||
55 | foreach ($declared as $className) { |
||
56 | $reflection = new \ReflectionClass($className); |
||
57 | if (in_array($reflection->getFileName(), $includedFiles, true)) { |
||
58 | $classes[] = $className; |
||
59 | } |
||
60 | } |
||
61 | |||
62 | return $classes; |
||
63 | } |
||
65 |