Conditions | 4 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 14 |
Ratio | 100 % |
Tests | 7 |
CRAP Score | 4.1755 |
Changes | 0 |
1 | <?php |
||
20 | 4 | View Code Duplication | public function applyToNode(Node $node) |
|
|||
21 | { |
||
22 | 4 | $instruction = $node->getInstruction($this); |
|
23 | |||
24 | 4 | $list = $this->resolve($instruction); |
|
25 | |||
26 | 4 | if (isset($list) && !is_array($list)) { |
|
27 | throw new \Exception("Unable to apply {$this->property} processing instruction:" |
||
28 | . " Expected an array, got a " . (is_object($list) ? get_class($list) . ' ' : '') . gettype($list)); |
||
29 | } |
||
30 | |||
31 | 4 | $result = $this->execute((array)$list); |
|
32 | 4 | $node->setResult($result); |
|
33 | 4 | } |
|
34 | |||
77 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.