Total Complexity | 10 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Coverage | 80.95% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | class ArrayNode extends Node implements \IteratorAggregate, \Countable |
||
19 | { |
||
20 | private $value; |
||
21 | private $isNative = true; |
||
22 | |||
23 | 343 | public function __construct(array $defaultValues = []) |
|
24 | { |
||
25 | 343 | $this->value = $defaultValues; |
|
26 | 343 | } |
|
27 | |||
28 | 341 | public function add($item) |
|
29 | { |
||
30 | 341 | if ($item instanceof Node) { |
|
31 | 202 | $item->setParent($this); |
|
32 | 202 | $this->isNative = false; |
|
33 | } |
||
34 | |||
35 | 341 | $this->value[] = $item; |
|
36 | 341 | } |
|
37 | |||
38 | #[\ReturnTypeWillChange] |
||
39 | public function count() |
||
40 | { |
||
41 | return count($this->value); |
||
42 | } |
||
43 | |||
44 | #[\ReturnTypeWillChange] |
||
48 | } |
||
49 | |||
50 | 343 | public function getNativeValue() |
|
51 | { |
||
52 | 343 | if (!$this->isNative) { |
|
53 | 202 | $this->resolve(); |
|
54 | } |
||
55 | |||
56 | 343 | return $this->value; |
|
57 | } |
||
58 | |||
59 | 202 | private function resolve() |
|
65 | 202 | } |
|
66 | } |
||
67 |