Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | 7 | public function modify(NodeInterface $tree): NodeInterface |
|
37 | { |
||
38 | /** @var ValueNodeInterface $item */ |
||
39 | 7 | foreach ($this->traverser->traverse($tree) as $item) { |
|
40 | 7 | if (null === $parent = $item->getParent()) { |
|
41 | 7 | continue; |
|
42 | } |
||
43 | |||
44 | 7 | if (!$item->isLeaf()) { |
|
45 | 4 | continue; |
|
46 | } |
||
47 | |||
48 | 7 | if (null !== $item->getValue()) { |
|
49 | 7 | continue; |
|
50 | } |
||
51 | |||
52 | 2 | $parent->remove($item); |
|
53 | } |
||
54 | |||
55 | 7 | return $tree; |
|
56 | } |
||
58 |