Skip to content

Commit 271a7a2

Browse files
authored
Merge pull request #75 from transistive/new-client
Integration with new php client
2 parents 58cf2b6 + 48b0cd7 commit 271a7a2

36 files changed

+770
-507
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NEO4J_CONNECTIONS=bolt://neo4j:test@neo4j,http://neo4j:test@neo4j,bolt://neo4j:test@core1

.github/workflows/ci.yml

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ jobs:
88
strategy:
99
max-parallel: 10
1010
matrix:
11-
php: [ '7.2', '7.3', '7.4']
12-
sf_version: [ '4.4.*', '5.1.*' ]
11+
php: [ '7.4', '8.0']
12+
sf_version: [ '5.1.*', '5.0.*', '5.2.*', '5.3.*' ]
1313

1414
steps:
1515
- name: Set up PHP
1616
uses: shivammathur/[email protected]
1717
with:
1818
php-version: ${{ matrix.php }}
1919
coverage: none
20-
tools: flex
2120

2221
- name: Checkout code
2322
uses: actions/checkout@v2
@@ -29,26 +28,4 @@ jobs:
2928
composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable
3029
3130
- name: Run tests
32-
run: ./vendor/bin/simple-phpunit
33-
34-
lowest:
35-
name: Lowest deps
36-
runs-on: ubuntu-latest
37-
steps:
38-
- name: Set up PHP
39-
uses: shivammathur/[email protected]
40-
with:
41-
php-version: 7.3
42-
coverage: none
43-
44-
- name: Checkout code
45-
uses: actions/checkout@v2
46-
47-
- name: Download dependencies
48-
run: |
49-
composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable --prefer-lowest
50-
51-
- name: Run tests
52-
env:
53-
SYMFONY_DEPRECATIONS_HELPER: "max[self]=0"
54-
run: ./vendor/bin/simple-phpunit
31+
run: ./vendor/bin/phpunit

.github/workflows/static.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ jobs:
1717
- name: Download dependencies
1818
run: composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable
1919

20-
- name: PHPStan
21-
uses: docker://oskarstark/phpstan-ga
22-
env:
23-
REQUIRE_DEV: false
24-
CHECK_PLATFORM_REQUIREMENTS: false
25-
with:
26-
args: analyze --no-progress
27-
2820
php-cs-fixer:
2921
name: PHP-CS-Fixer
3022
runs-on: ubuntu-latest
@@ -33,7 +25,7 @@ jobs:
3325
- name: PHP-CS-Fixer
3426
uses: docker://oskarstark/php-cs-fixer-ga
3527
with:
36-
args: --dry-run --diff-format udiff
28+
args: --dry-run
3729

3830
psalm:
3931
name: Psalm

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66
/vendor/
77
.php_cs.cache
88
.phpunit.result.cache
9+
.idea
10+
.env
11+
.php-cs-fixer.cache

.php-cs-fixer.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
use PhpCsFixer\Config;
4+
use PhpCsFixer\Finder;
5+
6+
if (file_exists(__DIR__.'/vendor/autoload.php')) {
7+
require __DIR__.'/vendor/autoload.php';
8+
}
9+
10+
$finder = Finder::create()
11+
->in(__DIR__.'/')
12+
->exclude(__DIR__.'/vendor')
13+
;
14+
15+
return (new Config())
16+
->setRules([
17+
'@Symfony' => true,
18+
])
19+
->setFinder($finder)
20+
;

.php_cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

Collector/Neo4jDataCollector.php

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@
77
use Symfony\Component\HttpFoundation\Request;
88
use Symfony\Component\HttpFoundation\Response;
99
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
10+
use Throwable;
1011

1112
/**
1213
* @author Xavier Coureau <[email protected]>
1314
*/
1415
final class Neo4jDataCollector extends DataCollector
1516
{
16-
/**
17-
* @var QueryLogger
18-
*/
19-
private $queryLogger;
17+
private QueryLogger $queryLogger;
2018

2119
public function __construct(QueryLogger $logger)
2220
{
@@ -26,70 +24,54 @@ public function __construct(QueryLogger $logger)
2624
/**
2725
* {@inheritdoc}
2826
*/
29-
public function collect(Request $request, Response $response, \Throwable $exception = null)
27+
public function collect(Request $request, Response $response, Throwable $exception = null): void
3028
{
3129
$this->data['time'] = $this->queryLogger->getElapsedTime();
3230
$this->data['nb_queries'] = count($this->queryLogger);
3331
$this->data['statements'] = $this->queryLogger->getStatements();
34-
$this->data['failed_statements'] = array_filter($this->queryLogger->getStatements(), function ($statement) {
35-
return !isset($statement['success']) || !$statement['success'];
32+
$this->data['failed_statements'] = array_filter($this->queryLogger->getStatements(), static function ($statement) {
33+
return empty($statement['success']);
3634
});
3735
}
3836

39-
public function reset()
37+
public function reset(): void
4038
{
4139
$this->data = [];
4240
$this->queryLogger->reset();
4341
}
4442

45-
/**
46-
* @return int
47-
*/
48-
public function getQueryCount()
43+
public function getQueryCount(): int
4944
{
5045
return $this->data['nb_queries'];
5146
}
5247

5348
/**
5449
* Return all statements, successful and not successful.
55-
*
56-
* @return array
5750
*/
58-
public function getStatements()
51+
public function getStatements(): array
5952
{
6053
return $this->data['statements'];
6154
}
6255

6356
/**
6457
* Return not successful statements.
65-
*
66-
* @return array
6758
*/
68-
public function getFailedStatements()
59+
public function getFailedStatements(): array
6960
{
7061
return $this->data['failed_statements'];
7162
}
7263

73-
/**
74-
* @return float
75-
*/
76-
public function getTime()
64+
public function getTime(): float
7765
{
7866
return $this->data['time'];
7967
}
8068

81-
/**
82-
* @return float
83-
*/
84-
public function getTimeForQuery()
69+
public function getTimeForQuery(): float
8570
{
8671
return $this->data['time'];
8772
}
8873

89-
/**
90-
* @return string
91-
*/
92-
public function getName()
74+
public function getName(): string
9375
{
9476
return 'neo4j';
9577
}

0 commit comments

Comments
 (0)