2525 */ 
2626class  ArangoClient
2727{
28+     use  HandlesResponses;
2829    use  HandlesJson;
2930    use  HasManagers;
3031    use  SupportsTransactions;
@@ -88,7 +89,11 @@ public function request(string $method, string $uri, array|HttpRequestOptions $o
8889            $ this handleGuzzleException ($ e
8990        }
9091
91-         return  $ this cleanupResponse ($ response
92+         if  ($ responsenull ) {
93+             return  $ this cleanupResponse ($ response
94+         }
95+ 
96+         return  new  stdClass ();
9297    }
9398
9499    /** 
@@ -116,7 +121,7 @@ public function debugRequest(
116121        string  $ method
117122        string  $ uri
118123        array  $ options
119-         ?string  $ databasenull , 
124+         ?string  $ databasenull 
120125    ): ResponseInterface 
121126        $ uri$ this prependDatabaseToUri ($ uri$ database
122127        $ options'debug ' ] = true ;
@@ -142,23 +147,31 @@ protected function handleGuzzleException(Throwable $e): void
142147        $ code$ egetCode ();
143148
144149        if  ($ einstanceof  RequestException && $ ehasResponse ()) {
145-             $ decodedResponse$ this decodeResponse ($ egetResponse ());
146-             $ messagestring ) $ decodedResponseerrorMessage ;
147-             $ codeint ) $ decodedResponsecode ;
150+             $ response$ egetResponse ();
151+             if  ($ responsenull ) {
152+                 $ decodedResponse$ this decodeResponse ($ response
153+             }
154+             if  (isset ($ decodedResponseerrorMessage )) {
155+                 $ messagestring ) $ decodedResponseerrorMessage ;
156+             }
157+ 
158+             if  (isset ($ decodedResponsecode )) {
159+                 $ codeint ) $ decodedResponsecode ;
160+             }
148161        }
149162
150163        throw (
151-         new  ArangoException (
152-             $ code' -  '  . $ message
153-             $ code, 
154-         )
164+              new  ArangoException (
165+                  $ code' -  '  . $ message
166+                  $ code
167+              )
155168        );
156169    }
157170
158171    /** 
159172     * @SuppressWarnings(PHPMD.StaticAccess) 
160173     */ 
161-     protected  function  cleanupResponse (? ResponseInterface $ responsestdClass 
174+     protected  function  cleanupResponse (ResponseInterface $ responsestdClass 
162175    {
163176        $ response$ this decodeResponse ($ response
164177        unset($ responseerror );
@@ -175,16 +188,19 @@ protected function cleanupResponse(?ResponseInterface $response): stdClass
175188    public  function  prepare (
176189        string  $ query
177190        array  $ bindVars
178-         array  $ options, 
191+         array  $ options
179192    ): Traversable 
180193        return  new  Statement ($ this $ query$ bindVars$ options
181194    }
182195
183196    /** 
184-      * @return array<array-key,  mixed>  
197+      * @return mixed 
185198     */ 
186-     public  function  getConfig (): array 
199+     public  function  getConfig (string   $ value  =  null ): mixed 
187200    {
201+         if  ($ value
202+             return  $ this config ->$ value
203+         }
188204        return  $ this config ->toArray ();
189205    }
190206
0 commit comments