@@ -17,21 +17,23 @@ public function map(array $object): mixed
1717 {
1818 return match ($ object ['$type ' ]) {
1919 'Integer ' => $ object ['_value ' ],
20- 'float ' => $ object ['_value ' ],
20+ 'Float ' => $ object ['_value ' ],
2121 'String ' => $ object ['_value ' ],
2222 'Boolean ' => $ object ['_value ' ],
2323 'Null ' => $ object ['_value ' ],
24- 'Array ' => $ object ['_value ' ],
24+ 'Array ' => $ object ['_value ' ], // Handle generic arrays
25+ 'List ' => array_map ([$ this , 'map ' ], $ object ['_value ' ]), // Recursively map lists
2526 'Duration ' => $ object ['_value ' ],
2627 'OffsetDateTime ' => $ object ['_value ' ],
28+ 'Node ' => $ this ->mapNode ($ object ['_value ' ]),
2729 'Map ' => $ this ->mapProperties ($ object ['_value ' ]),
2830 'Point ' => $ this ->parseWKT ($ object ['_value ' ]),
29- 'Node ' => $ this ->mapNode ($ object ['_value ' ]),
3031 'Relationship ' => $ this ->mapRelationship ($ object ['_value ' ]),
3132 'Path ' => $ this ->mapPath ($ object ['_value ' ]),
3233 default => throw new \InvalidArgumentException ('Unknown type: ' . $ object ['$type ' ]),
3334 };
3435 }
36+
3537 public static function parseWKT (string $ wkt ): Point
3638 {
3739 $ sridPart = substr ($ wkt , 0 , strpos ($ wkt , '; ' ));
@@ -62,11 +64,12 @@ public static function parseWKT(string $wkt): Point
6264 private function mapNode (array $ nodeData ): Node
6365 {
6466 return new Node (
65- $ nodeData ['_labels ' ],
66- $ this ->mapProperties ($ nodeData ['_properties ' ])
67+ $ nodeData ['_labels ' ], // Labels of the node
68+ $ this ->mapProperties ($ nodeData ['_properties ' ]) // Mapped properties
6769 );
6870 }
6971
72+
7073 private function mapRelationship (array $ relationshipData ): Relationship
7174 {
7275 return new Relationship (
0 commit comments