Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 14 |
Ratio | 100 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
47 | 7 | public function flow(NodeInterface $node) |
|
48 | { |
||
49 | 7 | if (!($node instanceof FileNode)) { |
|
50 | 1 | throw new InvalidArgumentException("Node: $node should be an instance of FileNode"); |
|
51 | } |
||
52 | |||
53 | 6 | if (substr($this->target->getPath(), -1) == '/') { |
|
54 | 3 | $target = $this->target->getClone()->setPath($this->target->getPath() . $node->getFilename()); |
|
55 | 3 | } else { |
|
56 | 3 | $target = $this->target; |
|
57 | } |
||
58 | |||
59 | 6 | return $this->moveTo($node, $target); |
|
60 | } |
||
61 | } |
||
62 |
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.