Total Complexity | 11 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
13 | class Factory |
||
14 | { |
||
15 | use ProvidesDi; |
||
16 | |||
17 | public function before(Console $console) |
||
18 | { |
||
19 | $argv = $console->argv(); |
||
20 | $app = $console->app(); |
||
21 | $command = $app->commandFor($argv); |
||
22 | |||
23 | if ($this->isVersion($argv)) { |
||
24 | return $command->showVersion(); |
||
25 | } |
||
26 | |||
27 | if ($this->isGlobalHelp($argv)) { |
||
28 | return $app->showHelp(); |
||
29 | } |
||
30 | |||
31 | if ($this->isHelp($argv)) { |
||
32 | return $command->showHelp(); |
||
33 | } |
||
34 | |||
35 | $this->di()->setShared('command', $app->parse($argv)); |
||
36 | |||
37 | return true; |
||
38 | } |
||
39 | |||
40 | protected function isGlobalHelp(array $argv): bool |
||
41 | { |
||
42 | // For a specific help, it would be [cmd, task, action, --help] |
||
43 | // If it is just [cmd, --help] then we deduce it is global help! |
||
44 | |||
45 | $isGlobal = ($argv[1][0] ?? '-') === '-' && ($argv[2][0] ?? '-') === '-'; |
||
46 | |||
47 | return $isGlobal && $this->isHelp($argv); |
||
48 | } |
||
49 | |||
50 | protected function isHelp(array $argv): bool |
||
51 | { |
||
52 | return \in_array('--help', $argv) || \in_array('-h', $argv); |
||
53 | } |
||
54 | |||
55 | protected function isVersion(array $argv): bool |
||
58 | } |
||
59 | } |
||
60 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths