| Conditions | 8 |
| Paths | 7 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 43 | public function findCommands(): iterable |
||
| 44 | { |
||
| 45 | foreach (scandir(__DIR__, SCANDIR_SORT_NONE) as $file) { |
||
| 46 | if ($file === 'Command.php' || !Str::endsWith($file, 'Command.php')) { |
||
| 47 | continue; |
||
| 48 | } |
||
| 49 | |||
| 50 | // Extract the classname |
||
| 51 | $classname = __NAMESPACE__ . '\\' . Str::replaceLast('.php', '', $file); |
||
| 52 | if (class_exists($classname) && !interface_exists($classname)) { |
||
| 53 | try { |
||
| 54 | $class = new \ReflectionClass($classname); |
||
| 55 | |||
| 56 | if ($class->isInstantiable()) { |
||
| 57 | yield $classname; |
||
| 58 | } |
||
| 59 | } catch (\ReflectionException $e) { |
||
| 60 | // Ignore classes we can't reflect |
||
| 65 | } |