client = $client; if (!$this->client) { $this->client = new Client(); $this->client->getEventDispatcher()->addListener('request.error', function(Event $event) { // override guzzle default behavior of throwing exceptions // when 4xx & 5xx responses are encountered $event->stopPropagation(); }, -254); $this->client->addSubscriber(BackoffPlugin::getExponentialBackoff(5, array(500, 502, 503, 408))); } } /** * @param ZippyResource $resource * @param string $context * * @return ResourceReader */ public function getReader(ZippyResource $resource, $context) { return new LegacyGuzzleReader($resource, $this->client); } }