Total Complexity | 5 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | class RootNode |
||
13 | { |
||
14 | /** @var ParentNode[] */ |
||
15 | private $children = []; |
||
16 | |||
17 | public function addChild(ParentNode $item): void |
||
18 | { |
||
19 | $this->children[get_class($item->getItem())] = $item; |
||
20 | } |
||
21 | |||
22 | public function hasChildren(): bool |
||
23 | { |
||
24 | return false === empty($this->children); |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * @return ParentNode[] |
||
29 | */ |
||
30 | public function getChildren(): array |
||
33 | } |
||
34 | |||
35 | public function has(string $name): bool |
||
36 | { |
||
37 | return array_key_exists($name, $this->children); |
||
38 | } |
||
39 | |||
40 | public function get(string $name): ParentNode |
||
43 | } |
||
44 | } |
||
45 |