Conditions | 5 |
Paths | 4 |
Total Lines | 25 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
53 | private function loadCommands() |
||
54 | { |
||
55 | $commands = []; |
||
56 | |||
57 | /** @var \DirectoryIterator $fileInfo */ |
||
58 | foreach (new \DirectoryIterator(__DIR__ . '/Commands') as $fileInfo) |
||
59 | { |
||
60 | if ($fileInfo->isDot() || !$fileInfo->isFile()) |
||
61 | { |
||
62 | continue; |
||
63 | } |
||
64 | |||
65 | $command = $fileInfo->getBasename('.php'); |
||
66 | $className = __NAMESPACE__ . "\\Commands\\$command"; |
||
67 | |||
68 | if (false == class_exists($className)) |
||
|
|||
69 | { |
||
70 | throw new \RuntimeException(sprintf('Required class "%s" not found.', $className)); |
||
71 | } |
||
72 | |||
73 | $commands[strtolower(str_replace('Command', '', $command))] = $this->getContainer()->get($className); |
||
74 | } |
||
75 | |||
76 | return $commands; |
||
77 | } |
||
78 | } |
||
79 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.