Conditions | 5 |
Paths | 1 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | private function getRetryMiddleware(): callable |
||
29 | { |
||
30 | return Middleware::retry( |
||
31 | function ($retries, $request, $response, $exception) { |
||
32 | if ($retries > 10) { |
||
33 | return false; |
||
34 | } |
||
35 | if ($exception instanceof ConnectException) { |
||
36 | return true; |
||
37 | } |
||
38 | if ($response && \in_array($response->getStatusCode(), $this->retryStatusCodes, true)) { |
||
39 | return true; |
||
40 | } |
||
41 | |||
42 | return false; |
||
43 | } |
||
47 |