mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-31 20:52:45 +00:00
@@ -207,12 +207,42 @@ Curl::error($callback)
|
||||
Curl::exec($ch = null)
|
||||
Curl::execDone()
|
||||
Curl::get($url, $data = array())
|
||||
Curl::getAttempts()
|
||||
Curl::getBeforeSendCallback()
|
||||
Curl::getCompleteCallback()
|
||||
Curl::getCookie($key)
|
||||
Curl::getCurl()
|
||||
Curl::getCurlErrorCode()
|
||||
Curl::getCurlErrorMessage()
|
||||
Curl::getDownloadCompleteCallback()
|
||||
Curl::getErrorCallback()
|
||||
Curl::getErrorCode()
|
||||
Curl::getErrorMessage()
|
||||
Curl::getFileHandle()
|
||||
Curl::getHttpErrorMessage()
|
||||
Curl::getHttpStatusCode()
|
||||
Curl::getId()
|
||||
Curl::getInfo($opt = null)
|
||||
Curl::getJsonDecoder()
|
||||
Curl::getOpt($option)
|
||||
Curl::getRawResponse()
|
||||
Curl::getRawResponseHeaders()
|
||||
Curl::getRemainingRetries()
|
||||
Curl::getRequestHeaders()
|
||||
Curl::getResponse()
|
||||
Curl::getResponseCookie($key)
|
||||
Curl::getResponseCookies()
|
||||
Curl::getResponseHeaders()
|
||||
Curl::getRetries()
|
||||
Curl::getRetryDecider()
|
||||
Curl::getSuccessCallback()
|
||||
Curl::getUrl()
|
||||
Curl::getXmlDecoder()
|
||||
Curl::head($url, $data = array())
|
||||
Curl::isChildOfMultiCurl()
|
||||
Curl::isCurlError()
|
||||
Curl::isError()
|
||||
Curl::isHttpError()
|
||||
Curl::options($url, $data = array())
|
||||
Curl::patch($url, $data = array())
|
||||
Curl::post($url, $data = '', $follow_303_with_post = false)
|
||||
|
||||
+157
-14
@@ -42,7 +42,7 @@ class Curl
|
||||
|
||||
public $attempts = 0;
|
||||
public $retries = 0;
|
||||
public $isChildOfMultiCurl = false;
|
||||
public $childOfMultiCurl = false;
|
||||
public $remainingRetries = 0;
|
||||
public $retryDecider = null;
|
||||
|
||||
@@ -396,7 +396,7 @@ class Curl
|
||||
$this->setOpt(CURLOPT_NOBODY, false);
|
||||
|
||||
// Allow multicurl to attempt retry as needed.
|
||||
if ($this->isChildOfMultiCurl) {
|
||||
if ($this->isChildOfMultiCurl()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -741,18 +741,6 @@ class Curl
|
||||
return isset($this->responseCookies[$key]) ? $this->responseCookies[$key] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Response Cookies
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getResponseCookies()
|
||||
{
|
||||
return $this->responseCookies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Max Filesize
|
||||
*
|
||||
@@ -1211,6 +1199,161 @@ class Curl
|
||||
$this->initialize();
|
||||
}
|
||||
|
||||
public function getCurl()
|
||||
{
|
||||
return $this->curl;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function isError()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
public function getErrorCode()
|
||||
{
|
||||
return $this->errorCode;
|
||||
}
|
||||
|
||||
public function getErrorMessage()
|
||||
{
|
||||
return $this->errorMessage;
|
||||
}
|
||||
|
||||
public function isCurlError()
|
||||
{
|
||||
return $this->curlError;
|
||||
}
|
||||
|
||||
public function getCurlErrorCode()
|
||||
{
|
||||
return $this->curlErrorCode;
|
||||
}
|
||||
|
||||
public function getCurlErrorMessage()
|
||||
{
|
||||
return $this->curlErrorMessage;
|
||||
}
|
||||
|
||||
public function isHttpError()
|
||||
{
|
||||
return $this->httpError;
|
||||
}
|
||||
|
||||
public function getHttpStatusCode()
|
||||
{
|
||||
return $this->httpStatusCode;
|
||||
}
|
||||
|
||||
public function getHttpErrorMessage()
|
||||
{
|
||||
return $this->httpErrorMessage;
|
||||
}
|
||||
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function getRequestHeaders()
|
||||
{
|
||||
return $this->requestHeaders;
|
||||
}
|
||||
|
||||
public function getResponseHeaders()
|
||||
{
|
||||
return $this->responseHeaders;
|
||||
}
|
||||
|
||||
public function getRawResponseHeaders()
|
||||
{
|
||||
return $this->rawResponseHeaders;
|
||||
}
|
||||
|
||||
public function getResponseCookies()
|
||||
{
|
||||
return $this->responseCookies;
|
||||
}
|
||||
|
||||
public function getResponse()
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
public function getRawResponse()
|
||||
{
|
||||
return $this->rawResponse;
|
||||
}
|
||||
|
||||
public function getBeforeSendCallback()
|
||||
{
|
||||
return $this->beforeSendCallback;
|
||||
}
|
||||
|
||||
public function getDownloadCompleteCallback()
|
||||
{
|
||||
return $this->downloadCompleteCallback;
|
||||
}
|
||||
|
||||
public function getSuccessCallback()
|
||||
{
|
||||
return $this->successCallback;
|
||||
}
|
||||
|
||||
public function getErrorCallback()
|
||||
{
|
||||
return $this->errorCallback;
|
||||
}
|
||||
|
||||
public function getCompleteCallback()
|
||||
{
|
||||
return $this->completeCallback;
|
||||
}
|
||||
|
||||
public function getFileHandle()
|
||||
{
|
||||
return $this->fileHandle;
|
||||
}
|
||||
|
||||
public function getAttempts()
|
||||
{
|
||||
return $this->attempts;
|
||||
}
|
||||
|
||||
public function getRetries()
|
||||
{
|
||||
return $this->retries;
|
||||
}
|
||||
|
||||
public function isChildOfMultiCurl()
|
||||
{
|
||||
return $this->childOfMultiCurl;
|
||||
}
|
||||
|
||||
public function getRemainingRetries()
|
||||
{
|
||||
return $this->remainingRetries;
|
||||
}
|
||||
|
||||
public function getRetryDecider()
|
||||
{
|
||||
return $this->retryDecider;
|
||||
}
|
||||
|
||||
public function getJsonDecoder()
|
||||
{
|
||||
return $this->jsonDecoder;
|
||||
}
|
||||
|
||||
public function getXmlDecoder()
|
||||
{
|
||||
return $this->xmlDecoder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destruct
|
||||
*
|
||||
|
||||
@@ -812,7 +812,7 @@ class MultiCurl
|
||||
{
|
||||
// Use sequential ids to allow for ordered post processing.
|
||||
$curl->id = $this->nextCurlId++;
|
||||
$curl->isChildOfMultiCurl = true;
|
||||
$curl->childOfMultiCurl = true;
|
||||
$this->curls[$curl->id] = $curl;
|
||||
|
||||
$curl->setHeaders($this->headers);
|
||||
|
||||
@@ -3676,4 +3676,16 @@ class CurlTest extends \PHPUnit\Framework\TestCase
|
||||
$user_agent = $test->server('server', 'GET', array('key' => 'HTTP_USER_AGENT'));
|
||||
$this->assertEquals($original_user_agent, $user_agent);
|
||||
}
|
||||
|
||||
public function testMock()
|
||||
{
|
||||
$curl = $this->getMockBuilder('Curl\Curl')
|
||||
->getMock();
|
||||
|
||||
$curl->expects($this->once())
|
||||
->method('getRawResponse')
|
||||
->will($this->returnValue('[]'));
|
||||
|
||||
$this->assertEquals('[]', $curl->getRawResponse());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ EOF
|
||||
# Skip hhvm "Notice: File could not be loaded: ..."
|
||||
if [[ "${TRAVIS_PHP_VERSION}" != "hhvm" ]] && [[ "${TRAVIS_PHP_VERSION}" != "hhvm-nightly" ]]; then
|
||||
export -f "find_invalid_indentation"
|
||||
invalid_indentation=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec bash -c 'find_invalid_indentation "{}"' \;)
|
||||
invalid_indentation=$(find . -type "f" -iname "*.php" ! -path "*/tests/*" ! -path "*/vendor/*" -exec bash -c 'find_invalid_indentation "{}"' \;)
|
||||
if [[ ! -z "${invalid_indentation}" ]]; then
|
||||
echo "${invalid_indentation}"
|
||||
((errors++))
|
||||
|
||||
Reference in New Issue
Block a user