Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
41 | 1 | public function modify(NodeInterface $tree): NodeInterface |
|
42 | { |
||
43 | 1 | foreach ($this->traverser->traverse($tree) as $item) { |
|
44 | 1 | if (null === $parent = $item->getParent()) { |
|
45 | 1 | continue; |
|
46 | } |
||
47 | |||
48 | 1 | if (!(bool) ($this->filter)($item)) { |
|
49 | 1 | continue; |
|
50 | } |
||
51 | |||
52 | 1 | $parent->remove($item); |
|
53 | } |
||
54 | |||
55 | 1 | return $tree; |
|
56 | } |
||
58 |