@@ -249,25 +249,11 @@ private function wrapHandler(callable $handler): callable
249
249
$ options
250
250
);
251
251
}
252
-
253
- $ this ->log ->warning ("Out of retries, throwing exception from $ node " );
254
- // Only throw if we run out of retries
255
- throw $ exception ;
256
- } else {
257
- // Something went seriously wrong, bail
258
- $ exception = new TransportException ($ response ['error ' ]->getMessage ());
259
- $ this ->logRequestFail (
260
- $ request ['http_method ' ],
261
- $ response ['effective_url ' ],
262
- $ request ['body ' ],
263
- $ request ['headers ' ],
264
- (int ) $ response ['status ' ],
265
- $ response ['body ' ],
266
- (float ) $ response ['transfer_stats ' ]['total_time ' ],
267
- $ exception
268
- );
269
- throw $ exception ;
270
252
}
253
+
254
+ $ this ->log ->warning ("Out of retries, throwing exception from $ node " );
255
+ // Only throw if we run out of retries
256
+ throw $ exception ;
271
257
} else {
272
258
// Something went seriously wrong, bail
273
259
$ exception = new TransportException ($ response ['error ' ]->getMessage ());
@@ -277,38 +263,26 @@ private function wrapHandler(callable $handler): callable
277
263
} else {
278
264
$ connection ->markAlive ();
279
265
280
- if (isset ($ response ['body ' ]) === true ) {
281
- $ response ['body ' ] = stream_get_contents ($ response ['body ' ]);
282
- $ this ->lastRequest ['response ' ]['body ' ] = $ response ['body ' ];
283
- }
266
+ if (isset ($ response ['body ' ]) === true ) {
267
+ $ response ['body ' ] = stream_get_contents ($ response ['body ' ]);
268
+ $ this ->lastRequest ['response ' ]['body ' ] = $ response ['body ' ];
269
+ }
284
270
285
- if ($ response ['status ' ] >= 400 && $ response ['status ' ] < 500 ) {
286
- $ ignore = $ request ['client ' ]['ignore ' ] ?? [];
287
- // Skip 404 if succeeded true in the body (e.g. clear_scroll)
288
- $ body = $ response ['body ' ] ?? '' ;
289
- if (strpos ($ body , '"succeeded":true ' ) !== false ) {
290
- $ ignore [] = 404 ;
291
- }
292
- $ this ->process4xxError ($ request , $ response , $ ignore );
293
- } elseif ($ response ['status ' ] >= 500 ) {
294
- $ ignore = $ request ['client ' ]['ignore ' ] ?? [];
295
- $ this ->process5xxError ($ request , $ response , $ ignore );
271
+ if ($ response ['status ' ] >= 400 && $ response ['status ' ] < 500 ) {
272
+ $ ignore = $ request ['client ' ]['ignore ' ] ?? [];
273
+ // Skip 404 if succeeded true in the body (e.g. clear_scroll)
274
+ $ body = $ response ['body ' ] ?? '' ;
275
+ if (strpos ($ body , '"succeeded":true ' ) !== false ) {
276
+ $ ignore [] = 404 ;
296
277
}
297
-
298
- // No error, deserialize
299
- $ response ['body ' ] = $ this ->serializer ->deserialize ($ response ['body ' ], $ response ['transfer_stats ' ]);
278
+ $ this ->process4xxError ($ request , $ response , $ ignore );
279
+ } elseif ($ response ['status ' ] >= 500 ) {
280
+ $ ignore = $ request ['client ' ]['ignore ' ] ?? [];
281
+ $ this ->process5xxError ($ request , $ response , $ ignore );
300
282
}
301
- $ this ->logRequestSuccess (
302
- $ request ['http_method ' ],
303
- $ response ['effective_url ' ],
304
- $ request ['body ' ],
305
- $ request ['headers ' ],
306
- (int ) $ response ['status ' ],
307
- (array ) $ response ['body ' ],
308
- (float ) $ response ['transfer_stats ' ]['total_time ' ]
309
- );
310
-
311
- return isset ($ request ['client ' ]['verbose ' ]) && $ request ['client ' ]['verbose ' ] === true ? $ response : $ response ['body ' ];
283
+
284
+ // No error, deserialize
285
+ $ response ['body ' ] = $ this ->serializer ->deserialize ($ response ['body ' ], $ response ['transfer_stats ' ]);
312
286
}
313
287
$ this ->logRequestSuccess ($ request , $ response );
314
288
@@ -350,7 +324,7 @@ function (&$value, &$key) {
350
324
* @param array $response
351
325
* @return void
352
326
*/
353
- public function logRequestSuccess ($ request , $ response )
327
+ public function logRequestSuccess (array $ request , array $ response ): void
354
328
{
355
329
$ this ->log ->debug ('Request Body ' , array ($ request ['body ' ]));
356
330
$ this ->log ->info (
@@ -389,7 +363,7 @@ public function logRequestSuccess($request, $response)
389
363
*
390
364
* @return void
391
365
*/
392
- public function logRequestFail ($ request , $ response , \Exception $ exception )
366
+ public function logRequestFail (array $ request , array $ response , \Exception $ exception ): void
393
367
{
394
368
$ this ->log ->debug ('Request Body ' , array ($ request ['body ' ]));
395
369
$ this ->log ->warning (
0 commit comments