| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 5 | public function run(array $args) |
|
|
|
|||
| 18 | { |
||
| 19 | 5 | if (!isset($args[0])) { |
|
| 20 | 1 | return self::fromPhpType($_GET); |
|
| 21 | } |
||
| 22 | 4 | $index = $args[0]->value(); |
|
| 23 | 4 | if (!isset($_GET[$index])) { |
|
| 24 | 1 | throw new ArgumentException('".get": Index "' . $index . '" not found.'); |
|
| 25 | } |
||
| 26 | 3 | return self::fromPhpType($_GET[$index]); |
|
| 27 | } |
||
| 28 | } |
||
| 29 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: