|
8 | 8 | use Neo4j\QueryAPI\Objects\Path;
|
9 | 9 | use InvalidArgumentException;
|
10 | 10 |
|
11 |
| -/** |
12 |
| - * @api |
13 |
| - */ |
14 |
| -class OGM |
| 11 | +final class OGM |
15 | 12 | {
|
16 | 13 | /**
|
17 | 14 | * @param array<array-key, mixed> $data
|
@@ -57,44 +54,18 @@ private function mapNode(array $nodeData): Node
|
57 | 54 | {
|
58 | 55 | return new Node(
|
59 | 56 | labels: $nodeData['_labels'] ?? [],
|
60 |
| - properties: $this->mapProperties($nodeData['_properties'] ?? []) // ✅ Fix: Ensure properties exist |
| 57 | + properties: $this->mapProperties($nodeData['_properties'] ?? []) |
61 | 58 | );
|
62 | 59 | }
|
63 | 60 |
|
64 | 61 | private function mapRelationship(array $relationshipData): Relationship
|
65 | 62 | {
|
66 | 63 | return new Relationship(
|
67 |
| - type: $relationshipData['_type'] ?? 'UNKNOWN', // ✅ Fix: Default to 'UNKNOWN' |
| 64 | + type: $relationshipData['_type'] ?? 'UNKNOWN', |
68 | 65 | properties: $this->mapProperties($relationshipData['_properties'] ?? [])
|
69 | 66 | );
|
70 | 67 | }
|
71 | 68 |
|
72 |
| - |
73 |
| - public static function parseWKT(string $wkt): Point |
74 |
| - { |
75 |
| - $sridPos = strpos($wkt, ';'); |
76 |
| - if ($sridPos === false) { |
77 |
| - throw new \InvalidArgumentException("Invalid WKT format: missing ';'"); |
78 |
| - } |
79 |
| - $sridPart = substr($wkt, 0, $sridPos); |
80 |
| - $srid = (int)str_replace('SRID=', '', $sridPart); |
81 |
| - |
82 |
| - $pointPos = strpos($wkt, 'POINT'); |
83 |
| - if ($pointPos === false) { |
84 |
| - throw new \InvalidArgumentException("Invalid WKT format: missing 'POINT'"); |
85 |
| - } |
86 |
| - $pointPart = substr($wkt, $pointPos + 6); |
87 |
| - |
88 |
| - $pointPart = str_replace('Z', '', $pointPart); |
89 |
| - $pointPart = trim($pointPart, ' ()'); |
90 |
| - $coordinates = explode(' ', $pointPart); |
91 |
| - |
92 |
| - [$x, $y, $z] = array_pad(array_map('floatval', $coordinates), 3, 0.0); |
93 |
| - |
94 |
| - return new Point($x, $y, $z, $srid); |
95 |
| - } |
96 |
| - |
97 |
| - |
98 | 69 | private function mapPath(array $pathData): Path
|
99 | 70 | {
|
100 | 71 | $nodes = [];
|
|
0 commit comments