37
37
final class GetServerInfo implements RequestHandlerInterface
38
38
{
39
39
public function __construct (
40
- private MainRepository $ repository
41
- ) {}
40
+ private MainRepository $ repository ,
41
+ ) {
42
+ }
42
43
43
44
/**
44
45
* @param GetServerInfoRequest $request
@@ -53,7 +54,6 @@ public function handle($request): TestkitResponseInterface
53
54
}
54
55
55
56
return $ this ->getServerInfoFromSession ($ driver );
56
-
57
57
} catch (Exception $ e ) {
58
58
$ uuid = Uuid::v4 ();
59
59
@@ -81,6 +81,7 @@ private function getServerInfoFromDriver($driver): ServerInfoResponse
81
81
try {
82
82
$ pool = $ this ->getConnectionPool ($ driver );
83
83
$ connection = $ this ->acquireConnectionFromPool ($ pool , SessionConfiguration::default ());
84
+
84
85
return new ServerInfoResponse ($ this ->extractServerInfo ($ connection ));
85
86
} finally {
86
87
if ($ connection !== null && $ pool !== null ) {
@@ -120,15 +121,7 @@ private function acquireConnectionFromPool($pool, SessionConfiguration $sessionC
120
121
if (method_exists ($ pool , 'getRoutingTable ' )) {
121
122
$ routingTable = $ pool ->getRoutingTable ();
122
123
if ($ routingTable !== null && empty ($ routingTable ->getReaders ())) {
123
- throw new Neo4jException ([
124
- new Neo4jError (
125
- 'No readers available in routing table ' ,
126
- 'N/A ' ,
127
- 'ClientError ' ,
128
- 'Routing ' ,
129
- 'RoutingTable '
130
- )
131
- ]);
124
+ throw new Neo4jException ([new Neo4jError ('No readers available in routing table ' , 'N/A ' , 'ClientError ' , 'Routing ' , 'RoutingTable ' )]);
132
125
}
133
126
}
134
127
@@ -153,8 +146,8 @@ private function extractServerInfo($connection): ServerInfo
153
146
}
154
147
}
155
148
156
- $ address = $ connection ->getServerAddress ();
157
- $ agent = $ connection ->getServerAgent ();
149
+ $ address = $ connection ->getServerAddress ();
150
+ $ agent = $ connection ->getServerAgent ();
158
151
$ protocol = $ connection ->getProtocol ();
159
152
160
153
if (empty ($ address ) || empty ($ agent )) {
@@ -178,6 +171,7 @@ private function getServerInfoFromSession($driver): ServerInfoResponse
178
171
179
172
try {
180
173
$ result = $ session ->run ('RETURN 1 ' );
174
+
181
175
return new ServerInfoResponse ($ result ->summary ()->getServerInfo ());
182
176
} finally {
183
177
$ session ->close ();
0 commit comments