| Total Complexity | 5 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | final class NodeObjectValue implements NodeValueInterface, ObjectValueInterface |
||
| 15 | { |
||
| 16 | |||
| 17 | private $data; |
||
| 18 | |||
| 19 | private $path; |
||
| 20 | |||
| 21 | private $valueFactory; |
||
| 22 | |||
| 23 | public function __construct( |
||
| 24 | stdClass $data, |
||
| 25 | PathInterface $path, |
||
| 26 | NodeValueFactoryInterface $valueFactory |
||
| 27 | ) { |
||
| 28 | $this->data = $data; |
||
| 29 | $this->path = $path; |
||
| 30 | $this->valueFactory = $valueFactory; |
||
| 31 | } |
||
| 32 | |||
| 33 | public function createChildIterator(): Iterator |
||
| 36 | } |
||
| 37 | |||
| 38 | private function createChildGenerator(): Generator |
||
| 39 | { |
||
| 40 | foreach (get_object_vars($this->data) as $name => $property) { |
||
| 41 | $stringName = (string) $name; |
||
| 42 | yield $stringName => $this |
||
| 43 | ->valueFactory |
||
| 44 | ->createValue($property, $this->path->copyWithProperty($stringName)); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | |||
| 48 | public function getPath(): PathInterface |
||
| 51 | } |
||
| 52 | } |
||
| 53 |