Conditions | 3 |
Paths | 4 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
19 | 2 | public function export(NodeInterface $node): array |
|
20 | { |
||
21 | 2 | $children = []; |
|
22 | |||
23 | /** @var NodeInterface $child */ |
||
24 | 2 | foreach ($node->children() as $child) { |
|
25 | 2 | $children[] = $this->export($child); |
|
26 | } |
||
27 | |||
28 | 2 | return [] === $children ? |
|
29 | 2 | ['value' => $node->label()] : |
|
30 | 2 | ['value' => $node->label(), 'children' => $children]; |
|
31 | } |
||
33 |