Conditions | 7 |
Paths | 17 |
Total Lines | 27 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 7 |
1 | <?php |
||
26 | 5 | public function parseArguments(ExecutorInterface $executor) |
|
27 | { |
||
28 | 5 | $first = true; |
|
29 | 5 | $value = null; |
|
30 | |||
31 | 5 | foreach ($this->getArguments() as $argument) { |
|
32 | 5 | $arguments = null($value) ? [] : [$value]; |
|
33 | |||
34 | 5 | if ($argument instanceof ActionInterface) { |
|
35 | 3 | if (false === $first) { |
|
36 | 3 | $argument->setArguments($arguments); |
|
37 | } |
||
38 | |||
39 | 3 | $value = $executor->execute($argument); |
|
40 | 4 | } elseif (is_callable($argument)) { |
|
41 | 3 | $value = call_user_func_array($argument, $arguments); |
|
42 | } else { |
||
43 | 4 | $value = $argument; |
|
44 | } |
||
45 | |||
46 | 5 | if (true === $first) { |
|
47 | 5 | $first = false; |
|
48 | } |
||
49 | } |
||
50 | |||
51 | 5 | return $value; |
|
52 | } |
||
53 | } |
||
54 |