| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | 7 | public function modify(NodeInterface $tree): NodeInterface |
|
| 37 | { |
||
| 38 | /** @var NaryNodeInterface $item */ |
||
| 39 | 7 | foreach ($this->traverser->traverse($tree) as $item) { |
|
| 40 | 7 | $capacity = $item->capacity(); |
|
| 41 | |||
| 42 | 7 | if (!$item->isLeaf()) { |
|
| 43 | 7 | $children = iterator_to_array($item->children()); |
|
| 44 | |||
| 45 | 7 | while ($item->degree() !== $capacity) { |
|
| 46 | 5 | $item->add(current($children)->clone()); |
|
| 47 | } |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | 7 | return $tree; |
|
| 52 | } |
||
| 54 |