easy-curl update
This commit is contained in:
parent
a37287a3a6
commit
8eefa537c0
@ -10,7 +10,7 @@ class Collection
|
||||
|
||||
/**
|
||||
* Converts current object to array
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
@ -20,10 +20,9 @@ class Collection
|
||||
|
||||
/**
|
||||
* Sets value
|
||||
*
|
||||
*
|
||||
* @param mixed $key Key
|
||||
* @param mixed $value Value
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set($key, $value = null)
|
||||
@ -40,9 +39,8 @@ class Collection
|
||||
|
||||
/**
|
||||
* Checks if key does exist
|
||||
*
|
||||
*
|
||||
* @param mixed $key Key
|
||||
*
|
||||
* @return bool TRUE if exists, FALSE otherwise
|
||||
*/
|
||||
public function has($key)
|
||||
@ -51,10 +49,10 @@ class Collection
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns value of $key, throws Exception if does not exist
|
||||
*
|
||||
* Returns value of $key
|
||||
*
|
||||
* @param mixed $key Key
|
||||
*
|
||||
* @throws Exception Key does not exist
|
||||
* @return mixed Value of key
|
||||
*/
|
||||
public function get($key)
|
||||
@ -68,9 +66,8 @@ class Collection
|
||||
|
||||
/**
|
||||
* Removes key
|
||||
*
|
||||
*
|
||||
* @param mixed $key Key to remove
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function remove($key)
|
||||
|
@ -10,9 +10,8 @@ class Options extends Collection
|
||||
|
||||
/**
|
||||
* Applies options to Request object
|
||||
*
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function applyTo(Request $request)
|
||||
@ -26,7 +25,7 @@ class Options extends Collection
|
||||
|
||||
/**
|
||||
* Prepares array for intelligent setters
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function loadCurlConstantsTable()
|
||||
@ -44,10 +43,10 @@ class Options extends Collection
|
||||
|
||||
/**
|
||||
* Intelligent setters
|
||||
*
|
||||
*
|
||||
* @param string $name Function name
|
||||
* @param array $args Arguments
|
||||
*
|
||||
* @throws Exception Invalid CURLOPT_ constant has been specified
|
||||
* @return self
|
||||
*/
|
||||
public function __call($name, $args)
|
||||
|
@ -24,8 +24,6 @@ class Request extends EventDispatcher implements RequestInterface
|
||||
* Create new cURL handle
|
||||
*
|
||||
* @param string $url The URL to fetch.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($url = null)
|
||||
{
|
||||
@ -39,8 +37,6 @@ class Request extends EventDispatcher implements RequestInterface
|
||||
* Closes cURL resource and frees the memory.
|
||||
* It is neccessary when you make a lot of requests
|
||||
* and you want to avoid fill up the memory.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
@ -67,7 +63,6 @@ class Request extends EventDispatcher implements RequestInterface
|
||||
* Sets Options
|
||||
*
|
||||
* @param Options $options Options
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOptions(Options $options)
|
||||
|
@ -22,7 +22,7 @@ class RequestsQueue extends EventDispatcher implements RequestsQueueInterface, C
|
||||
protected $runningCount = 0;
|
||||
|
||||
/**
|
||||
* @var array Array of requests attached
|
||||
* @var Request[] Array of requests attached
|
||||
*/
|
||||
protected $queue = array();
|
||||
|
||||
@ -32,9 +32,7 @@ class RequestsQueue extends EventDispatcher implements RequestsQueueInterface, C
|
||||
protected $running = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* Initializes curl_multi handler
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@ -70,7 +68,6 @@ class RequestsQueue extends EventDispatcher implements RequestsQueueInterface, C
|
||||
* Overrides default options with given Options object
|
||||
*
|
||||
* @param Options $defaultOptions New options
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setDefaultOptions(Options $defaultOptions)
|
||||
@ -92,7 +89,6 @@ class RequestsQueue extends EventDispatcher implements RequestsQueueInterface, C
|
||||
* Attach request to queue.
|
||||
*
|
||||
* @param Request $request Request to add
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function attach(Request $request)
|
||||
@ -105,7 +101,6 @@ class RequestsQueue extends EventDispatcher implements RequestsQueueInterface, C
|
||||
* Detach request from queue.
|
||||
*
|
||||
* @param Request $request Request to remove
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function detach(Request $request)
|
||||
@ -169,7 +164,7 @@ class RequestsQueue extends EventDispatcher implements RequestsQueueInterface, C
|
||||
/**
|
||||
* Returns requests present in $queue but not in $running
|
||||
*
|
||||
* @return array Array of requests
|
||||
* @return Request[] Array of requests
|
||||
*/
|
||||
protected function getRequestsNotRunning()
|
||||
{
|
||||
@ -178,7 +173,8 @@ class RequestsQueue extends EventDispatcher implements RequestsQueueInterface, C
|
||||
|
||||
/**
|
||||
* Download available data on socket.
|
||||
*
|
||||
*
|
||||
* @throws Exception
|
||||
* @return bool TRUE when there are any requests on queue, FALSE when finished
|
||||
*/
|
||||
public function socketPerform()
|
||||
@ -186,8 +182,7 @@ class RequestsQueue extends EventDispatcher implements RequestsQueueInterface, C
|
||||
if ($this->count() == 0) {
|
||||
throw new Exception('Cannot perform if there are no requests in queue.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
$notRunning = $this->getRequestsNotRunning();
|
||||
do {
|
||||
/**
|
||||
@ -221,8 +216,8 @@ class RequestsQueue extends EventDispatcher implements RequestsQueueInterface, C
|
||||
* return FALSE on a select failure or timeout (from the underlying
|
||||
* select system call)
|
||||
*
|
||||
* @param float $timeout Maximum time to wait
|
||||
*
|
||||
* @param float|int $timeout Maximum time to wait
|
||||
* @throws Exception
|
||||
* @return bool
|
||||
*/
|
||||
public function socketSelect($timeout = 1)
|
||||
|
@ -12,8 +12,6 @@ class Response
|
||||
*
|
||||
* @param Request $request Request
|
||||
* @param string $content Content of reponse
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Request $request, $content = null)
|
||||
{
|
||||
@ -31,7 +29,6 @@ class Response
|
||||
* the following elements (which correspond to opt), or FALSE on failure.
|
||||
*
|
||||
* @param int $key One of the CURLINFO_* constants
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getInfo($key = null)
|
||||
@ -53,7 +50,6 @@ class Response
|
||||
* Sets error instance
|
||||
*
|
||||
* @param Error $error Error to set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setError(Error $error)
|
||||
|
Loading…
Reference in New Issue
Block a user