16
16
use function array_slice ;
17
17
use ArrayIterator ;
18
18
use function count ;
19
- use Ds \Map ;
20
- use Ds \Vector ;
21
19
use Exception ;
22
20
use Laudis \Neo4j \Contracts \ConnectionInterface ;
23
21
use Laudis \Neo4j \Contracts \FormatterInterface ;
@@ -81,11 +79,11 @@ public function formatBoltResult(array $meta, array $results, ConnectionInterfac
81
79
/** @var list<list<mixed>> $results */
82
80
$ results = array_slice ($ results , 0 , count ($ results ) - 1 );
83
81
84
- /** @var Vector <CypherMap<OGMTypes>> $tbr */
85
- $ tbr = new Vector () ;
82
+ /** @var list <CypherMap<OGMTypes>> $tbr */
83
+ $ tbr = [] ;
86
84
87
85
foreach ($ results as $ result ) {
88
- $ tbr-> push ( $ this ->formatRow ($ meta , $ result) );
86
+ $ tbr[] = $ this ->formatRow ($ meta , $ result );
89
87
}
90
88
91
89
return new CypherList ($ tbr );
@@ -96,12 +94,12 @@ public function formatBoltResult(array $meta, array $results, ConnectionInterfac
96
94
*/
97
95
public function formatHttpResult (ResponseInterface $ response , array $ body , ConnectionInterface $ connection , float $ resultsAvailableAfter , float $ resultsConsumedAfter , iterable $ statements ): CypherList
98
96
{
99
- /** @var Vector <CypherList<CypherMap<OGMTypes>>> $tbr */
100
- $ tbr = new Vector () ;
97
+ /** @var list <CypherList<CypherMap<OGMTypes>>> $tbr */
98
+ $ tbr = [] ;
101
99
102
100
foreach ($ body ['results ' ] as $ results ) {
103
101
/** @var CypherResult $results */
104
- $ tbr-> push ( $ this ->buildResult ($ results) );
102
+ $ tbr[] = $ this ->buildResult ($ results );
105
103
}
106
104
107
105
return new CypherList ($ tbr );
@@ -116,22 +114,22 @@ public function formatHttpResult(ResponseInterface $response, array $body, Conne
116
114
*/
117
115
private function buildResult (array $ result ): CypherList
118
116
{
119
- /** @var Vector <CypherMap<OGMTypes>> $tbr */
120
- $ tbr = new Vector () ;
117
+ /** @var list <CypherMap<OGMTypes>> $tbr */
118
+ $ tbr = [] ;
121
119
122
120
$ columns = $ result ['columns ' ];
123
121
foreach ($ result ['data ' ] as $ data ) {
124
122
$ meta = new ArrayIterator ($ data ['meta ' ]);
125
123
$ nodes = $ data ['graph ' ]['nodes ' ];
126
124
$ relationship = new ArrayIterator ($ data ['graph ' ]['relationships ' ]);
127
125
128
- /** @var Map <string, OGMTypes> $record */
129
- $ record = new Map () ;
126
+ /** @var array <string, OGMTypes> $record */
127
+ $ record = [] ;
130
128
foreach ($ data ['row ' ] as $ i => $ value ) {
131
- $ record-> put ( $ columns [$ i ], $ this ->httpTranslator ->translate ($ meta , $ relationship , $ nodes , $ value) );
129
+ $ record[ $ columns [$ i ]] = $ this ->httpTranslator ->translate ($ meta , $ relationship , $ nodes , $ value );
132
130
}
133
131
134
- $ tbr-> push ( new CypherMap ($ record) );
132
+ $ tbr[] = new CypherMap ($ record );
135
133
}
136
134
137
135
return new CypherList ($ tbr );
@@ -145,10 +143,10 @@ private function buildResult(array $result): CypherList
145
143
*/
146
144
private function formatRow (array $ meta , array $ result ): CypherMap
147
145
{
148
- /** @var Map <string, OGMTypes> $map */
149
- $ map = new Map () ;
146
+ /** @var array <string, OGMTypes> $map */
147
+ $ map = [] ;
150
148
foreach ($ meta ['fields ' ] as $ i => $ column ) {
151
- $ map-> put ( $ column, $ this ->boltTranslator ->mapValueToType ($ result [$ i ]) );
149
+ $ map[ $ column] = $ this ->boltTranslator ->mapValueToType ($ result [$ i ]);
152
150
}
153
151
154
152
return new CypherMap ($ map );
0 commit comments