Conditions | 8 |
Paths | 10 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 8.0291 |
Changes | 0 |
1 | <?php |
||
20 | 6 | public function applyToNode(Node $node) |
|
21 | { |
||
22 | 6 | $instruction = $node->getInstruction($this); |
|
23 | |||
24 | 6 | if (is_array($instruction) || is_object($instruction)) { |
|
25 | 6 | $instruction = (object)$instruction; |
|
26 | 6 | } |
|
27 | |||
28 | 6 | if (!isset($instruction) || !isset($instruction->condition)) { |
|
29 | return; |
||
30 | } |
||
31 | |||
32 | 6 | if ($instruction->condition) { |
|
33 | 3 | $result = isset($instruction->then) ? $instruction->then : $node->getResult(); |
|
34 | 3 | } else { |
|
35 | 3 | $result = isset($instruction->else) ? $instruction->else : null; |
|
36 | } |
||
37 | |||
38 | 6 | $node->setResult($result); |
|
39 | 6 | } |
|
40 | } |
||
41 |