Example #1
0
 /**
  * @return void
  */
 protected function makeException()
 {
     $this->thrownException = new CurlException($this->request, curl_error($this->request->__getDescriptor()), curl_errno($this->request->__getDescriptor()));
 }
Example #2
0
 /**
  * @param Request $request
  * @param null $body
  * @param null $exception
  * 
  * @return Response
  */
 protected static function makeResponse(Request $request, $body = null, $exception = null)
 {
     $descriptor = $request->__getDescriptor();
     $headers = null;
     if (!is_null($body) and ($header_size = curl_getinfo($descriptor, CURLINFO_HEADER_SIZE)) > 0) {
         $headers = substr($body, 0, $header_size);
         $body = substr($body, $header_size);
     }
     $http_response_code = curl_getinfo($descriptor, CURLINFO_HTTP_CODE);
     return new Response($request, $body, $headers, $http_response_code, $exception);
 }