Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 9 |
Ratio | 100 % |
Tests | 5 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
45 | 4 | public function flow(NodeInterface $node) |
|
46 | { |
||
47 | 4 | if (!($node instanceof NodeCollectionInterface)) { |
|
48 | 1 | throw new InvalidArgumentException("The supplied $node is not a NodeCollectionInterface"); |
|
49 | } |
||
50 | 3 | $this->log(LogLevel::DEBUG, "Selecting the last entry from {node}", ['node' => $node]); |
|
51 | |||
52 | 3 | return $node->last($this->callback); |
|
53 | } |
||
54 | } |
||
55 |
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.