Conditions | 4 |
Paths | 5 |
Total Lines | 19 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
16 | 12 | public function __invoke(NodeCollection $nodeCollection, $key, array $values): NodeCollection |
|
17 | { |
||
18 | 12 | $nodes = new NodeCollection; |
|
19 | |||
20 | 12 | foreach($nodeCollection as $node) |
|
21 | { |
||
22 | 12 | if(in_array($node->entry($key), $values)) |
|
23 | { |
||
24 | 12 | $nodes->add($node); |
|
25 | } |
||
26 | |||
27 | 12 | if(!$node->children()->isEmpty()) |
|
28 | { |
||
29 | 11 | $nodes->merge($this->__invoke($node->children(), $key, $values)); |
|
30 | } |
||
31 | } |
||
32 | |||
33 | 12 | return $nodes; |
|
34 | } |
||
35 | } |
||
36 |