Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | public function __construct(ClientInterface $client = null) |
||
23 | { |
||
24 | $this->client = $client; |
||
25 | |||
26 | if (!$this->client) { |
||
27 | $this->client = new Client(); |
||
28 | |||
29 | $this->client->getEventDispatcher()->addListener('request.error', function(Event $event) { |
||
30 | // override guzzle default behavior of throwing exceptions |
||
31 | // when 4xx & 5xx responses are encountered |
||
32 | $event->stopPropagation(); |
||
33 | }, -254); |
||
34 | |||
35 | $this->client->addSubscriber(BackoffPlugin::getExponentialBackoff(5, array(500, 502, 503, 408))); |
||
36 | } |
||
37 | } |
||
38 | |||
48 |