Conditions | 4 |
Paths | 8 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
23 | 2 | public function sendRequests(array $requests): BatchResult |
|
24 | { |
||
25 | 2 | $batchResult = new BatchResult(); |
|
26 | |||
27 | 2 | foreach ($requests as $request) { |
|
28 | try { |
||
29 | 2 | $response = $this->client->sendRequest($request); |
|
30 | 2 | $batchResult = $batchResult->addResponse($request, $response); |
|
31 | 1 | } catch (ClientExceptionInterface $e) { |
|
32 | 1 | $batchResult = $batchResult->addException($request, $e); |
|
33 | } |
||
34 | } |
||
35 | |||
36 | 2 | if ($batchResult->hasExceptions()) { |
|
37 | 1 | throw new BatchException($batchResult); |
|
38 | } |
||
39 | |||
40 | 1 | return $batchResult; |
|
41 | } |
||
42 | } |
||
43 |