Total Complexity | 4 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
10 | class Bottom extends AddStrategyAbstract |
||
11 | { |
||
12 | /** |
||
13 | * {@inheritdoc} |
||
14 | */ |
||
15 | 3 | protected function canCreateNewNode(NodeInfo $targetNode): void |
|
16 | { |
||
17 | 3 | if ($targetNode->isRoot()) { |
|
18 | 1 | throw new ValidationException('Cannot create node. Target node is root. Root node cannot have sibling.'); |
|
19 | } |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | */ |
||
25 | 2 | protected function makeHole(NodeInfo $targetNode): void |
|
26 | { |
||
27 | 2 | $moveFromIndex = $targetNode->getRight(); |
|
28 | 2 | $this->getManipulator()->moveLeftIndexes($moveFromIndex, 2, $targetNode->getScope()); |
|
29 | 2 | $this->getManipulator()->moveRightIndexes($moveFromIndex, 2, $targetNode->getScope()); |
|
30 | } |
||
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | 2 | protected function createNewNodeNodeInfo(NodeInfo $targetNode): NodeInfo |
|
44 | ); |
||
45 | } |
||
46 | } |
||
47 |