| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | 1 | public function modify(NodeInterface $tree): NodeInterface |
|
| 33 | { |
||
| 34 | /** @var \loophp\phptree\Node\MerkleNode $item */ |
||
| 35 | 1 | foreach ($tree->all() as $item) { |
|
| 36 | 1 | if (null === $parent = $item->getParent()) { |
|
| 37 | 1 | continue; |
|
| 38 | } |
||
| 39 | |||
| 40 | 1 | if (false === (bool) ($this->filter)($item)) { |
|
| 41 | 1 | continue; |
|
| 42 | } |
||
| 43 | |||
| 44 | 1 | $parent->remove($item); |
|
| 45 | 1 | $this->modify($parent); |
|
| 46 | } |
||
| 47 | |||
| 48 | 1 | return $tree; |
|
| 49 | } |
||
| 51 |