|
18 | 18 | use function is_int;
|
19 | 19 | use Laudis\Neo4j\Contracts\ConnectionInterface;
|
20 | 20 | use Laudis\Neo4j\Contracts\FormatterInterface;
|
21 |
| -use Laudis\Neo4j\Databags\SummarizedResult; |
22 | 21 | use Laudis\Neo4j\Databags\ResultSummary;
|
23 | 22 | use Laudis\Neo4j\Databags\ServerInfo;
|
24 | 23 | use Laudis\Neo4j\Databags\Statement;
|
| 24 | +use Laudis\Neo4j\Databags\SummarizedResult; |
25 | 25 | use Laudis\Neo4j\Databags\SummaryCounters;
|
26 | 26 | use Laudis\Neo4j\Enum\QueryTypeEnum;
|
27 | 27 | use Laudis\Neo4j\Types\CypherList;
|
@@ -51,7 +51,13 @@ public function __construct(FormatterInterface $formatter)
|
51 | 51 | $this->formatter = $formatter;
|
52 | 52 | }
|
53 | 53 |
|
54 |
| - public function formatHttpStats(array $response, ConnectionInterface $connection, Statement $statement, float $resultAvailableAfter, float $resultConsumedAfter, CypherList $results): SummarizedResult |
| 54 | + /** |
| 55 | + * @param CypherResponse $response |
| 56 | + * @param T $results |
| 57 | + * |
| 58 | + * @return SummarizedResult<T> |
| 59 | + */ |
| 60 | + public function formatHttpStats(array $response, ConnectionInterface $connection, Statement $statement, float $resultAvailableAfter, float $resultConsumedAfter, $results): SummarizedResult |
55 | 61 | {
|
56 | 62 | if (!isset($response['stats'])) {
|
57 | 63 | throw new UnexpectedValueException('No stats found in the response set');
|
@@ -163,13 +169,15 @@ public function formatBoltResult(array $meta, array $results, ConnectionInterfac
|
163 | 169 |
|
164 | 170 | public function formatHttpResult(ResponseInterface $response, array $body, ConnectionInterface $connection, float $resultsAvailableAfter, float $resultsConsumedAfter, iterable $statements): CypherList
|
165 | 171 | {
|
166 |
| - /** @var Vector<SummarizedResult> $tbr */ |
| 172 | + /** @var Vector<SummarizedResult<T>> */ |
167 | 173 | $tbr = new Vector();
|
168 | 174 |
|
169 | 175 | $toDecorate = $this->formatter->formatHttpResult($response, $body, $connection, $resultsAvailableAfter, $resultsConsumedAfter, $statements);
|
170 |
| - foreach ($statements as $i => $statement) { |
| 176 | + $i = 0; |
| 177 | + foreach ($statements as $statement) { |
171 | 178 | $result = $body['results'][$i];
|
172 | 179 | $tbr->push($this->formatHttpStats($result, $connection, $statement, $resultsAvailableAfter, $resultsConsumedAfter, $toDecorate->get($i)));
|
| 180 | + ++$i; |
173 | 181 | }
|
174 | 182 |
|
175 | 183 | return new CypherList($tbr);
|
|
0 commit comments