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