| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 19 | protected function chooseHttpClient() |
||
| 20 | { |
||
| 21 | 5 | $clientPool = array_filter($this->clientPool, function (HttpClientPoolItem $clientPoolItem) { |
|
| 22 | 4 | return !$clientPoolItem->isDisabled(); |
|
| 23 | 5 | }); |
|
| 24 | |||
| 25 | 5 | if (0 === count($clientPool)) { |
|
| 26 | 2 | throw new HttpClientNotFoundException('Cannot choose a http client as there is no one present in the pool'); |
|
| 27 | } |
||
| 28 | |||
| 29 | 4 | return $clientPool[array_rand($clientPool)]; |
|
| 30 | } |
||
| 31 | } |
||
| 32 |