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