/** * @param \Guzzle\Http\Message\Response $guzzleResponse * @param ActionsInterface $action * @return Response */ public static function parseGuzzleResponse(\Guzzle\Http\Message\Response $guzzleResponse, ActionsInterface $action) { $response = new self(); if ($guzzleResponse->getStatusCode() != 200) { $response->setStatus(false); $response->setError($response::ERROR_REQUEST_ERROR); return $response; } $responseArray = json_decode($guzzleResponse->getBody(true), true); $response->setStatus($responseArray['ok']); if ($response->getStatus() === false) { $response->setError($responseArray['error']); return $response; } $response->setData($action->parseResponse($responseArray)); return $response; }