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