Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | 9 | public function getClassInstance($command, ArrayAccess $input, array $extra = []) |
|
19 | { |
||
20 | 9 | $injected = []; |
|
21 | |||
22 | 9 | $reflection = new ReflectionClass($command); |
|
23 | |||
24 | 9 | if ($constructor = $reflection->getConstructor()) { |
|
25 | 4 | $injected = array_map(function ($parameter) use ($input, $extra) { |
|
26 | 4 | return $this->getParameterValueForCommand($input, $parameter, $extra); |
|
27 | 4 | }, $constructor->getParameters()); |
|
28 | } |
||
29 | |||
30 | 8 | return $reflection->newInstanceArgs($injected); |
|
31 | } |
||
32 | |||
62 |