@@ -73,6 +73,23 @@ public function __construct()
73
73
];
74
74
}
75
75
76
+ public function decorateRequest (RequestInterface $ request ): RequestInterface
77
+ {
78
+ /** @psalm-suppress ImpureMethodCall */
79
+ return $ request ->withHeader (
80
+ 'Accept ' ,
81
+ 'application/vnd.neo4j.jolt+json-seq;strict=true;charset=UTF-8 '
82
+ );
83
+ }
84
+
85
+ /**
86
+ * @return array{resultDataContents?: list<'GRAPH'|'ROW'|'REST'>, includeStats?:bool}
87
+ */
88
+ public function statementConfigOverride (): array
89
+ {
90
+ return [];
91
+ }
92
+
76
93
/**
77
94
* @return CypherList<CypherList<CypherMap<OGMTypes>>>
78
95
*/
@@ -126,37 +143,6 @@ private function translateJoltType(?stdClass $value)
126
143
return $ this ->rawToTypes [$ key ]($ input );
127
144
}
128
145
129
- /**
130
- * @return OGMTypes
131
- *
132
- * @psalm-suppress ImpureMethodCall
133
- * @psalm-suppress PossiblyFalseReference
134
- */
135
- private function translateDateTime (string $ datetime )
136
- {
137
- if (preg_match ('/^[\-−]?\d+-\d{2}-\d{2}$/u ' , $ datetime )) {
138
- $ date = DateTimeImmutable::createFromFormat ('Y-m-d ' , $ datetime );
139
-
140
- return new Date ((int ) $ date ->diff (new DateTimeImmutable ('@0 ' ))->format ('%a ' ));
141
- }
142
-
143
- if (preg_match ('/^(\d{2}):(\d{2}):(\d{2})((\.)(\d+))?$/ ' , $ datetime , $ matches )) {
144
- $ nanoseconds = $ this ->nanosecondsFromMatches ($ matches );
145
-
146
- return new LocalTime ($ nanoseconds );
147
- }
148
-
149
- if (preg_match ('/^(\d{2}):(\d{2}):(\d{2})((\.)(\d+))?(?<zone>.+)$/ ' , $ datetime , $ matches )) {
150
- $ nanoseconds = $ this ->nanosecondsFromMatches ($ matches );
151
-
152
- $ offset = $ this ->offsetFromMatches ($ matches );
153
-
154
- return new Time ($ nanoseconds , $ offset );
155
- }
156
-
157
- throw new UnexpectedValueException ('Date/time values have not been implemented yet ' );
158
- }
159
-
160
146
/**
161
147
* Assumes that 2D points are of the form "SRID=$srid;POINT($x $y)" and 3D points are of the form "SRID=$srid;POINT Z($x $y $z)".
162
148
*
@@ -290,23 +276,6 @@ private function translatePath(array $value): Path
290
276
return new Path (new CypherList ($ nodes ), new CypherList ($ relations ), new CypherList ($ ids ));
291
277
}
292
278
293
- public function decorateRequest (RequestInterface $ request ): RequestInterface
294
- {
295
- /** @psalm-suppress ImpureMethodCall */
296
- return $ request ->withHeader (
297
- 'Accept ' ,
298
- 'application/vnd.neo4j.jolt+json-seq;strict=true;charset=UTF-8 '
299
- );
300
- }
301
-
302
- /**
303
- * @return array{resultDataContents?: list<'GRAPH'|'ROW'|'REST'>, includeStats?:bool}
304
- */
305
- public function statementConfigOverride (): array
306
- {
307
- return [];
308
- }
309
-
310
279
/**
311
280
* @param array{0: int, 1: list<string>, 2: stdClass} $value
312
281
*/
@@ -336,6 +305,37 @@ private function translateBinary(): Closure
336
305
throw new UnexpectedValueException ('Binary data has not been implemented ' );
337
306
}
338
307
308
+ /**
309
+ * @return OGMTypes
310
+ *
311
+ * @psalm-suppress ImpureMethodCall
312
+ * @psalm-suppress PossiblyFalseReference
313
+ */
314
+ private function translateDateTime (string $ datetime )
315
+ {
316
+ if (preg_match ('/^[\-−]?\d+-\d{2}-\d{2}$/u ' , $ datetime )) {
317
+ $ date = DateTimeImmutable::createFromFormat ('Y-m-d ' , $ datetime );
318
+
319
+ return new Date ((int ) $ date ->diff (new DateTimeImmutable ('@0 ' ))->format ('%a ' ));
320
+ }
321
+
322
+ if (preg_match ('/^(\d{2}):(\d{2}):(\d{2})((\.)(\d+))?$/ ' , $ datetime , $ matches )) {
323
+ $ nanoseconds = $ this ->nanosecondsFromMatches ($ matches );
324
+
325
+ return new LocalTime ($ nanoseconds );
326
+ }
327
+
328
+ if (preg_match ('/^(\d{2}):(\d{2}):(\d{2})((\.)(\d+))?(?<zone>.+)$/ ' , $ datetime , $ matches )) {
329
+ $ nanoseconds = $ this ->nanosecondsFromMatches ($ matches );
330
+
331
+ $ offset = $ this ->offsetFromMatches ($ matches );
332
+
333
+ return new Time ($ nanoseconds , $ offset );
334
+ }
335
+
336
+ throw new UnexpectedValueException ('Date/time values have not been implemented yet ' );
337
+ }
338
+
339
339
private function nanosecondsFromMatches (array $ matches ): int
340
340
{
341
341
/** @var array{0: string, 1: string, 2: string, 3: string, 4?: array{0: string, 1: string}} $matches */
0 commit comments