11
11
12
12
namespace Laudis \Neo4j \Common ;
13
13
14
+ use Laudis \Neo4j \Databags \SessionConfiguration ;
14
15
use function array_key_exists ;
15
16
use function array_key_first ;
16
17
use function array_reduce ;
@@ -76,7 +77,7 @@ public function withSetup(DriverSetup $setup, ?string $alias = null, ?int $prior
76
77
/**
77
78
* @return DriverInterface<ResultFormat>
78
79
*/
79
- public function getDriver (?string $ alias = null ): DriverInterface
80
+ public function getDriver (SessionConfiguration $ config , ?string $ alias = null ): DriverInterface
80
81
{
81
82
$ alias ??= $ this ->decideAlias ($ alias );
82
83
@@ -90,7 +91,7 @@ public function getDriver(?string $alias = null): DriverInterface
90
91
$ setup = new DriverSetup (Uri::create (self ::DEFAULT_DRIVER_CONFIG ), Authenticate::disabled ());
91
92
$ this ->driverSetups ['default ' ]->insert ($ setup , PHP_INT_MIN );
92
93
93
- return $ this ->getDriver ();
94
+ return $ this ->getDriver ($ config );
94
95
}
95
96
96
97
if (array_key_exists ($ alias , $ this ->drivers )) {
@@ -104,7 +105,7 @@ public function getDriver(?string $alias = null): DriverInterface
104
105
105
106
$ driver = DriverFactory::create ($ uri , $ this ->configuration , $ auth , $ this ->formatter );
106
107
$ urisTried [] = $ uri ->__toString ();
107
- if ($ driver ->verifyConnectivity ()) {
108
+ if ($ driver ->verifyConnectivity ($ config )) {
108
109
$ this ->drivers [$ alias ] = $ driver ;
109
110
110
111
return $ driver ;
@@ -114,10 +115,10 @@ public function getDriver(?string $alias = null): DriverInterface
114
115
throw new RuntimeException (sprintf ('Cannot connect to any server on alias: %s with Uris: ( \'%s \') ' , $ alias , implode ('\', ' , array_unique ($ urisTried ))));
115
116
}
116
117
117
- public function verifyConnectivity (?string $ alias = null ): bool
118
+ public function verifyConnectivity (SessionConfiguration $ config , ?string $ alias = null ): bool
118
119
{
119
120
try {
120
- $ this ->getDriver ($ alias );
121
+ $ this ->getDriver ($ config , $ alias );
121
122
} catch (RuntimeException $ e ) {
122
123
return false ;
123
124
}
0 commit comments