Skip to content

Commit bd927e4

Browse files
renamed variable to keep name semantic
1 parent 3342857 commit bd927e4

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ See ``index.php`` file. It contains few examples how you can use this library. O
3030
```php
3131
<?php
3232
//Create new Bolt instance
33-
$neo4j = new \Bolt\Bolt();
33+
$bolt = new \Bolt\Bolt();
3434
//Set Bolt protocol version (default is newest 4.1)
35-
$neo4j->setProtocolVersions(4.1);
35+
$bolt->setProtocolVersions(4.1);
3636
//Connect to database
37-
$neo4j->init('MyClient/1.0', 'username', 'password);
37+
$bolt->init('MyClient/1.0', 'username', 'password);
3838
//Execute query
39-
$neo4j->run('RETURN 1 AS num, 2 AS cnt');
39+
$bolt->run('RETURN 1 AS num, 2 AS cnt');
4040
//Pull records from last query
41-
$rows = $neo4j->pull();
41+
$rows = $bolt->pull();
4242
```
4343

4444
| Method | Description |

index.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,63 +19,63 @@
1919

2020
try {
2121

22-
$neo4j = new \Bolt\Bolt();
23-
$neo4j->setProtocolVersions(4.1);
22+
$bolt = new \Bolt\Bolt();
23+
$bolt->setProtocolVersions(4.1);
2424

25-
if (!$neo4j->init('MyClient/1.0', $user, $password)) {
25+
if (!$bolt->init('MyClient/1.0', $user, $password)) {
2626
throw new Exception('Wrong login');
2727
}
2828

2929
//test fields
30-
$res = $neo4j->run('RETURN 1 AS num, 2 AS cnt');
30+
$res = $bolt->run('RETURN 1 AS num, 2 AS cnt');
3131
if (($res['fields'][0] ?? '') != 'num' || ($res['fields'][1] ?? '') != 'cnt') {
3232
throw new Exception('Wrong fields');
3333
}
3434

3535
//test record
36-
$res = $neo4j->pull();
36+
$res = $bolt->pull();
3737
if (($res[0][0] ?? 0) != 1 || ($res[0][1] ?? 0) != 2) {
3838
throw new Exception('Wrong record');
3939
}
4040

4141

4242
//test node create
43-
$neo4j->run('CREATE (a:Test) RETURN a, ID(a)');
44-
$created = $neo4j->pull();
43+
$bolt->run('CREATE (a:Test) RETURN a, ID(a)');
44+
$created = $bolt->pull();
4545
if (!($created[0][0] instanceof \Bolt\structures\Node)) {
4646
throw new Exception('Unsuccussful node create');
4747
}
4848

4949
//get neo4j version to use right placeholders
50-
$neo4j->run('call dbms.components() yield versions unwind versions as version return version');
51-
$neo4jVersion = $neo4j->pull()[0][0] ?? '';
50+
$bolt->run('call dbms.components() yield versions unwind versions as version return version');
51+
$neo4jVersion = $bolt->pull()[0][0] ?? '';
5252
$t = version_compare($neo4jVersion, '4') == -1;
5353

5454
//test delete created node
55-
$neo4j->run('MATCH (a:Test) WHERE ID(a) = ' . ($t ? '{a}' : '$a') . ' DELETE a', [
55+
$bolt->run('MATCH (a:Test) WHERE ID(a) = ' . ($t ? '{a}' : '$a') . ' DELETE a', [
5656
'a' => $created[0][1]
5757
]);
58-
$res = $neo4j->pull();
58+
$res = $bolt->pull();
5959
if (($res[0]['stats']['nodes-deleted'] ?? 0) != 1) {
6060
throw new Exception('Unsuccussful node delete');
6161
}
6262

6363
//transaction
64-
if ($neo4j->getProtocolVersion() >= 3) {
65-
$neo4j->begin();
66-
$neo4j->run('CREATE (a:Test) RETURN a, ID(a)');
67-
$created = $neo4j->pull();
68-
$neo4j->rollback();
64+
if ($bolt->getProtocolVersion() >= 3) {
65+
$bolt->begin();
66+
$bolt->run('CREATE (a:Test) RETURN a, ID(a)');
67+
$created = $bolt->pull();
68+
$bolt->rollback();
6969

70-
$neo4j->run('MATCH (a:Test) WHERE ID(a) = ' . ($t ? '{a}' : '$a') . ' RETURN COUNT(a)', [
70+
$bolt->run('MATCH (a:Test) WHERE ID(a) = ' . ($t ? '{a}' : '$a') . ' RETURN COUNT(a)', [
7171
'a' => $created[0][1]
7272
]);
73-
$res = $neo4j->pull();
73+
$res = $bolt->pull();
7474
if ($res[0][0] != 0)
7575
throw new Exception('Unsuccussful transaction rollback');
7676
}
7777

78-
unset($neo4j);
78+
unset($bolt);
7979

8080
echo '<br><br>Test successful';
8181

0 commit comments

Comments
 (0)