Skip to content

Commit 122a01c

Browse files
committed
test for Profile-query-plan working state
1 parent 2bf1796 commit 122a01c

File tree

4 files changed

+441
-106
lines changed

4 files changed

+441
-106
lines changed

.php-cs-fixer.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php declare(strict_types=1);
2+
3+
use PhpCsFixer\Config;
4+
use PhpCsFixer\Finder;
5+
6+
return (new Config())
7+
->setRiskyAllowed(true) // Allow risky fixers
8+
->setRules([
9+
'@PSR12' => true,
10+
'strict_param' => true, // This is a risky rule
11+
])
12+
->setFinder(
13+
Finder::create()
14+
->in(__DIR__)
15+
->exclude([
16+
'vendor',
17+
])
18+
);

src/Neo4jQueryAPI.php

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
use Exception;
66
use GuzzleHttp\Client;
7-
use GuzzleHttp\Exception\GuzzleException;
8-
use GuzzleHttp\Exception\RequestException;
97
use Neo4j\QueryAPI\Objects\ProfiledQueryPlanArguments;
108
use Neo4j\QueryAPI\Objects\ResultCounters;
119
use Neo4j\QueryAPI\Objects\ProfiledQueryPlan;
@@ -145,34 +143,34 @@ private function createProfileData(array $data): ProfiledQueryPlan
145143
}
146144

147145
$queryArguments = new ProfiledQueryPlanArguments(
148-
$mappedArguments['GlobalMemory'],
149-
$mappedArguments['planner-impl'],
150-
$mappedArguments['memory'],
151-
$mappedArguments['string-representation'],
152-
$mappedArguments['runtime'] ?? null,
153-
$mappedArguments['Time'],
154-
is_int($mappedArguments['PageCacheMisses']),
155-
is_int($mappedArguments['PageCacheHits']),
156-
$mappedArguments['runtime-impl'],
157-
$mappedArguments['version'],
158-
is_int($mappedArguments['DbHits']),
159-
$mappedArguments['batch-size'],
160-
is_string($mappedArguments['Details']),
161-
$mappedArguments['planner-version'],
162-
is_string($mappedArguments['PipelineInfo']),
163-
$mappedArguments['runtime-version'],
164-
is_int($mappedArguments['Id']),
165-
(float)($mappedArguments['EstimatedRows'] ?? 0.0),
166-
is_string($mappedArguments['planner'] ? $mappedArguments['planner'] : json_encode($mappedArguments['planner'])),
167-
is_int($mappedArguments['Rows'])
146+
globalMemory: $mappedArguments['GlobalMemory'] ?? null,
147+
plannerImpl: $mappedArguments['planner-impl'] ?? null,
148+
memory: $mappedArguments['Memory'] ?? null,
149+
stringRepresentation: $mappedArguments['string-representation'] ?? null,
150+
runtime: $mappedArguments['runtime'] ?? null,
151+
time: $mappedArguments['Time'] ?? null,
152+
pageCacheMisses: $mappedArguments['PageCacheMisses'] ?? null,
153+
pageCacheHits: $mappedArguments['PageCacheHits'] ?? null,
154+
runtimeImpl: $mappedArguments['runtime-impl'] ?? null,
155+
version: $mappedArguments['version'] ?? null,
156+
dbHits: $mappedArguments['DbHits'] ?? null,
157+
batchSize: $mappedArguments['batch-size'] ?? null,
158+
details: $mappedArguments['Details'] ?? null,
159+
plannerVersion: $mappedArguments['planner-version'] ?? null,
160+
pipelineInfo: $mappedArguments['PipelineInfo'] ?? null,
161+
runtimeVersion: $mappedArguments['runtime-version'] ?? null,
162+
id: $mappedArguments['Id'] ?? null,
163+
estimatedRows: $mappedArguments['EstimatedRows'] ?? null,
164+
planner: $mappedArguments['planner'] ?? null,
165+
rows: $mappedArguments['Rows' ?? null]
168166
);
169167

170168

171169
$profiledQueryPlan = new ProfiledQueryPlan(
172170
$data['dbHits'],
173171
$data['records'],
174172
$data['hasPageCacheStats'],
175-
$data['PageCacheHits'],
173+
$data['pageCacheHits'],
176174
$data['pageCacheMisses'],
177175
$data['pageCacheHitRatio'],
178176
$data['time'],

0 commit comments

Comments
 (0)