| Conditions | 4 |
| Paths | 3 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | 42 | public function execute( |
|
| 15 | HttpClient $client, |
||
| 16 | Targets $targets, |
||
| 17 | RequestInterface $request, |
||
| 18 | ResponseInterface $response, |
||
| 19 | string $action |
||
| 20 | ): ResponseInterface { |
||
| 21 | 42 | $firstSuccessfulResponse = null; |
|
| 22 | 42 | foreach ($targets as $target) { |
|
| 23 | 42 | $response = $client->send($request, $target, $action); |
|
| 24 | 42 | if ($firstSuccessfulResponse === null && $this->responseIsSuccessful($response)) { |
|
| 25 | 42 | $firstSuccessfulResponse = $response; |
|
| 26 | } |
||
| 27 | } |
||
| 28 | 42 | return $firstSuccessfulResponse ?? $response; |
|
| 29 | } |
||
| 30 | |||
| 36 |