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