Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
GuzzleHttp\Pool Class Reference
Inheritance diagram for GuzzleHttp\Pool:
GuzzleHttp\Promise\PromisorInterface

Public Member Functions

 __construct (ClientInterface $client, $requests, array $config=[])
 
 promise ()
 Get promise.
 

Static Public Member Functions

static batch (ClientInterface $client, $requests, array $options=[])
 Sends multiple requests concurrently and returns an array of responses and exceptions that uses the same ordering as the provided requests.
 

Constructor & Destructor Documentation

◆ __construct()

GuzzleHttp\Pool::__construct ( ClientInterface $client,
$requests,
array $config = [] )
Parameters
ClientInterface$clientClient used to send the requests.
array | Iterator$requestsRequests or functions that return requests to send concurrently.
array$configAssociative array of options
  • concurrency: (int) Maximum number of requests to send concurrently
  • options: Array of request options to apply to each request.
  • fulfilled: (callable) Function to invoke when a request completes.
  • rejected: (callable) Function to invoke when a request is rejected.

Member Function Documentation

◆ batch()

static GuzzleHttp\Pool::batch ( ClientInterface $client,
$requests,
array $options = [] )
static

Sends multiple requests concurrently and returns an array of responses and exceptions that uses the same ordering as the provided requests.

IMPORTANT: This method keeps every request and response in memory, and as such, is NOT recommended when sending a large number or an indeterminate number of requests concurrently.

Parameters
ClientInterface$clientClient used to send the requests
array | Iterator$requestsRequests to send concurrently.
array$optionsPasses through the options available in {
See also
GuzzleHttp\Pool\__construct}
Return values
arrayReturns an array containing the response or an exception in the same order that the requests were sent.
Exceptions
InvalidArgumentExceptionif the event format is incorrect.

◆ promise()

GuzzleHttp\Pool::promise ( )

Get promise.

Implements GuzzleHttp\Promise\PromisorInterface.


The documentation for this class was generated from the following file: