converter = $converter; $this->responseHandlers = $responseHandlers; } /** * @param \Zend_Http_Response $response * * @return bool|string */ public function getResult(\Zend_Http_Response $response) { $result = false; $converterMediaType = $this->converter->getContentMediaType(); /** Content-Type header may not only contain media-type declaration */ if ($response->getBody() && is_int(strripos($response->getHeader('Content-Type'), $converterMediaType))) { $responseBody = $this->converter->fromBody($response->getBody()); } else { $responseBody = []; } if (array_key_exists($response->getStatus(), $this->responseHandlers)) { $result = $this->responseHandlers[$response->getStatus()]->handleResponse($responseBody); } return $result; } }