Пример #1
0
 public function validateTimeoutedResponse(Response $response)
 {
     $this->assertEmpty($response->getContent());
     $this->assertTrue($response->hasError());
     $this->assertEquals(CURLE_OPERATION_TIMEOUTED, $response->getError()->getCode());
     $this->assertNotEmpty($response->getError()->getMessage());
 }
Пример #2
0
 /**
  * Returns HTML code for custom panel.
  * @return mixed
  */
 public function getPanel()
 {
     return $this->response ? $this->response->errorDump() : NULL;
 }
Пример #3
0
 /**
  * Perform a cURL session.
  * Equivalent to curl_exec().
  * This function should be called after initializing a cURL
  * session and all the options for the session are set.
  *
  * @return Response
  */
 public function send()
 {
     if ($this->options instanceof Options) {
         $this->options->applyTo($this);
     }
     $content = curl_exec($this->ch);
     $response = new Response($this, $content);
     $errorCode = curl_errno($this->ch);
     if ($errorCode !== CURLE_OK) {
         $response->setError(new Error(curl_error($this->ch), $errorCode));
     }
     return $response;
 }