14
14
use Laudis \Neo4j \Contracts \ConnectionInterface ;
15
15
use Laudis \Neo4j \Contracts \PointInterface ;
16
16
use Laudis \Neo4j \Formatter \OGMFormatter ;
17
+ use Laudis \Neo4j \Http \HttpHelper ;
18
+ use Laudis \Neo4j \Types \AbstractPropertyObject ;
17
19
use Laudis \Neo4j \Types \CypherList ;
20
+ use Laudis \Neo4j \Types \Cartesian3DPoint ;
21
+ use Laudis \Neo4j \Types \CartesianPoint ;
22
+ use Laudis \Neo4j \Types \WGS84Point ;
23
+ use Laudis \Neo4j \Types \WGS843DPoint ;
24
+ use Laudis \Neo4j \Types \Relation ;
25
+ use Laudis \Neo4j \Types \Node ;
18
26
use Laudis \Neo4j \Types \CypherMap ;
19
27
use Psr \Http \Message \RequestInterface ;
20
28
use Psr \Http \Message \ResponseInterface ;
@@ -38,7 +46,7 @@ public function __construct()
38
46
'Z ' => static fn (string $ value ): int => (int ) $ value ,
39
47
'R ' => static fn (string $ value ): float => (float ) $ value ,
40
48
'U ' => static fn (string $ value ): string => $ value ,
41
- 'T ' => fn (string $ value )/*TODO*/ => $ this ->translateDateTime ($ value ),
49
+ 'T ' => fn (string $ value ): AbstractPropertyObject => $ this ->translateDateTime ($ value ),
42
50
'@ ' => fn (string $ value ): PointInterface => $ this ->translatePoint ($ value ),
43
51
'# ' => static function (string $ value ) {
44
52
// TODO
@@ -82,6 +90,18 @@ public function formatHttpResult(
82
90
return new CypherList ($ allResults );
83
91
}
84
92
93
+ private function translateJoltType (?stdClass $ value ) {
94
+ if (is_null ($ value )) {
95
+ return null ;
96
+ }
97
+
98
+ [$ key , $ value ] = HttpHelper::splitJoltSingleton ($ value );
99
+ if (!isset ($ this ->rawToTypes [$ key ])) {
100
+ throw new UnexpectedValueException ('Unexpected Jolt key: ' . $ key );
101
+ }
102
+ return $ this ->rawToTypes [$ key ]($ value );
103
+ }
104
+
85
105
private function translateDateTime (string $ datetime )
86
106
{
87
107
// TODO; They're in ISO format so shouldn't be too hard
@@ -142,7 +162,7 @@ private function getSRID(string $value): int
142
162
private function getCoordinates (string $ value ): array
143
163
{
144
164
$ matches = [];
145
- if (!preg_match ('/^POINT ?(Z?) ?\(([0-9 ]+)\)$/ ' , $ value , $ matches )) {
165
+ if (!preg_match ('/^POINT ?(Z?) ?\(([0-9\. ]+)\)$/ ' , $ value , $ matches )) {
146
166
throw new UnexpectedValueException ('Unexpected point coordinates string: ' .$ value );
147
167
}
148
168
$ coordinates = explode (' ' , $ matches [2 ]);
0 commit comments