Total Complexity | 7 |
Total Lines | 60 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | class ParentNode |
||
15 | { |
||
16 | /** @var ContainerInterface */ |
||
17 | protected $container; |
||
18 | /** @var ParentNode[] */ |
||
19 | protected $children = []; |
||
20 | |||
21 | public function __construct(ContainerInterface $navigation) |
||
22 | { |
||
23 | $this->container = $navigation; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * @return ContainerInterface |
||
28 | */ |
||
29 | public function getContainer(): ContainerInterface |
||
30 | { |
||
31 | return $this->container; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param ParentNode $item |
||
36 | */ |
||
37 | public function addChild(ParentNode $item): void |
||
38 | { |
||
39 | $this->children[get_class($item->getContainer())] = $item; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return bool |
||
44 | */ |
||
45 | public function hasChildren(): bool |
||
46 | { |
||
47 | return false === empty($this->children); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @return array |
||
52 | */ |
||
53 | public function getChildren(): array |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * @param string $name |
||
60 | * @return bool |
||
61 | */ |
||
62 | public function has(string $name): bool |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @param string $name |
||
69 | * @return ParentNode |
||
70 | */ |
||
71 | public function get(string $name): ParentNode |
||
76 |