Total Complexity | 5 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | final class NodeArrayValue implements NodeValueInterface, ArrayValueInterface |
||
12 | { |
||
13 | |||
14 | private $data; |
||
15 | |||
16 | private $path; |
||
17 | |||
18 | private $valueFactory; |
||
19 | |||
20 | public function __construct( |
||
28 | } |
||
29 | |||
30 | public function createChildIterator(): Iterator |
||
31 | { |
||
32 | $validIndex = 0; |
||
33 | foreach ($this->data as $index => $element) { |
||
34 | if ($index !== $validIndex++) { |
||
35 | throw new Exception\InvalidElementKeyException($index, $this->path); |
||
36 | } |
||
37 | yield $index => $this |
||
38 | ->valueFactory |
||
39 | ->createValue($element, $this->path->copyWithElement($index)); |
||
40 | } |
||
41 | } |
||
42 | |||
43 | public function getPath(): PathInterface |
||
46 | } |
||
47 | } |
||
48 |