Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
14 | 6 | protected function getCommandAndArguments(array $argv = null) |
|
15 | { |
||
16 | // If no $argv is provided then use the global PHP defined $argv. |
||
17 | 6 | if (is_null($argv)) { |
|
18 | 3 | global $argv; |
|
|
|||
19 | 2 | } |
|
20 | |||
21 | 6 | $arguments = $argv; |
|
22 | 6 | $script = array_shift($arguments); |
|
23 | 6 | $command = array_shift($arguments); |
|
24 | |||
25 | 6 | return compact('arguments', 'script', 'command'); |
|
26 | } |
||
27 | } |
||
28 |
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state