Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
36 | public function get(array $requestOptions) |
||
37 | { |
||
38 | $poolIndex = array_rand(self::$serverPool); |
||
39 | try { |
||
40 | return $this->guzzleClient->get(self::$serverPool[$poolIndex], $requestOptions); |
||
41 | } catch (RequestException $e) { |
||
42 | if ($e->getResponse()) { |
||
43 | throw $e; |
||
44 | } |
||
45 | } |
||
46 | |||
47 | // There is no server response (timeout, DNS failure); try again. |
||
48 | $poolIndex = ($poolIndex + 1) % count(self::$serverPool); |
||
49 | |||
50 | return $this->guzzleClient->get(self::$serverPool[$poolIndex], $requestOptions); |
||
51 | } |
||
52 | |||
58 |