CurlMultiProxy
extends AbstractHasDispatcher
in package
implements
CurlMultiInterface
Proxies requests and connections to a pool of internal curl_multi handles. Each recursive call will add requests to the next available CurlMulti handle.
Table of Contents
Interfaces
- CurlMultiInterface
- Interface for sending a pool of {@see RequestInterface} objects in parallel
Properties
- $eventDispatcher : EventDispatcherInterface
- $groups : mixed
- $handles : mixed
- $maxHandles : mixed
- $queued : mixed
- $selectTimeout : mixed
Methods
- __construct() : mixed
- add() : CurlMultiInterface
- Add a request to the pool.
- addSubscriber() : self
- Add an event subscriber to the dispatcher
- all() : array<string|int, mixed>
- Get an array of attached {@see RequestInterface} objects
- count() : mixed
- dispatch() : Event
- Helper to dispatch Guzzle events and set the event name on the event
- getAllEvents() : array<string|int, mixed>
- Get a list of all of the events emitted from the class
- getEventDispatcher() : EventDispatcherInterface
- Get the EventDispatcher of the request
- remove() : bool
- Remove a request from the pool.
- reset() : mixed
- Reset the state and remove any attached RequestInterface objects
- send() : mixed
- Send a pool of {@see RequestInterface} requests.
- setEventDispatcher() : self
- Set the EventDispatcher of the request
- cleanupHandles() : mixed
- Trims down unused CurlMulti handles to limit the number of open connections
- getAvailableHandle() : CurlMulti
- Get an existing available CurlMulti handle or create a new one
Properties
$eventDispatcher
protected
EventDispatcherInterface
$eventDispatcher
$groups
protected
mixed
$groups
= array()
$handles
protected
mixed
$handles
= array()
$maxHandles
protected
mixed
$maxHandles
$queued
protected
mixed
$queued
= array()
$selectTimeout
protected
mixed
$selectTimeout
Methods
__construct()
public
__construct([int $maxHandles = 3 ][, float $selectTimeout = 1.0 ]) : mixed
Parameters
- $maxHandles : int = 3
-
The maximum number of idle CurlMulti handles to allow to remain open
- $selectTimeout : float = 1.0
-
timeout for curl_multi_select
add()
Add a request to the pool.
public
add(RequestInterface $request) : CurlMultiInterface
Parameters
- $request : RequestInterface
-
Request to add
Return values
CurlMultiInterfaceaddSubscriber()
Add an event subscriber to the dispatcher
public
addSubscriber(EventSubscriberInterface $subscriber) : self
Parameters
- $subscriber : EventSubscriberInterface
-
Event subscriber
Return values
selfall()
Get an array of attached {@see RequestInterface} objects
public
all() : array<string|int, mixed>
Return values
array<string|int, mixed>count()
public
count() : mixed
Attributes
- #[ReturnTypeWillChange]
dispatch()
Helper to dispatch Guzzle events and set the event name on the event
public
dispatch(mixed $eventName[, array<string|int, mixed> $context = array() ]) : Event
Parameters
- $eventName : mixed
-
Name of the event to dispatch
- $context : array<string|int, mixed> = array()
-
Context of the event
Return values
Event —Returns the created event object
getAllEvents()
Get a list of all of the events emitted from the class
public
static getAllEvents() : array<string|int, mixed>
Return values
array<string|int, mixed>getEventDispatcher()
Get the EventDispatcher of the request
public
getEventDispatcher() : EventDispatcherInterface
Return values
EventDispatcherInterfaceremove()
Remove a request from the pool.
public
remove(RequestInterface $request) : bool
Parameters
- $request : RequestInterface
-
Request to remove
Return values
bool —Returns true on success or false on failure
reset()
Reset the state and remove any attached RequestInterface objects
public
reset([mixed $hard = false ]) : mixed
Parameters
- $hard : mixed = false
-
Set to true to close and reopen any open multi handles
send()
Send a pool of {@see RequestInterface} requests.
public
send() : mixed
setEventDispatcher()
Set the EventDispatcher of the request
public
setEventDispatcher(EventDispatcherInterface $eventDispatcher) : self
Parameters
- $eventDispatcher : EventDispatcherInterface
Return values
selfcleanupHandles()
Trims down unused CurlMulti handles to limit the number of open connections
protected
cleanupHandles() : mixed
getAvailableHandle()
Get an existing available CurlMulti handle or create a new one
protected
getAvailableHandle() : CurlMulti