示例#1
0
 /**
  * Inject the dependencies from an other response.
  * @param HttpResponse $httpResponse
  * @return \Brickoo\Component\Http\HttpResponse
  */
 public function inject(HttpResponse $httpResponse)
 {
     $this->version = $httpResponse->getVersion();
     $this->status = $httpResponse->getStatus();
     $this->message = $httpResponse->getMessage();
     return $this;
 }
示例#2
0
 /**
  * Retrive http exception from HttpResponse object.
  *
  * @param HttpResponse $httpResponse
  * @return string
  */
 protected function getHttpException($httpResponse)
 {
     $exception = '';
     $headers = $httpResponse->getHeaders();
     if (isset($headers['Content-type'])) {
         if (strpos(strtolower($headers['Content-type']), strtolower(Resource::Content_Type_ATOM)) !== FALSE) {
             $exception = $httpResponse->getMessage();
         } else {
             $exception = $httpResponse->getBody();
         }
     } else {
         $exception = $httpResponse->getMessage();
     }
     return $exception;
 }