Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
42 | 4 | protected function getParameterValueForCommand( |
|
43 | ArrayAccess $source, |
||
44 | ReflectionParameter $parameter, |
||
45 | array $extras = [] |
||
46 | ) { |
||
47 | 4 | if (array_key_exists($parameter->name, $extras)) { |
|
48 | 1 | return $extras[$parameter->name]; |
|
49 | } |
||
50 | |||
51 | 4 | if (isset($source[$parameter->name])) { |
|
52 | 2 | return $source[$parameter->name]; |
|
53 | } |
||
54 | |||
55 | 2 | if ($parameter->isDefaultValueAvailable()) { |
|
56 | 1 | return $parameter->getDefaultValue(); |
|
57 | } |
||
58 | |||
59 | 1 | throw new InvalidArgumentException("Unable to map input to command: {$parameter->name}"); |
|
60 | } |
||
61 | } |
||
62 |