YoastSEO_Vendor\GuzzleHttp
Pool::batch() public Yoast 1.0
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.
{} Это метод класса: Pool{}
Хуков нет.
Возвращает
Массив. Returns an array containing the response or an exception in the same order that the requests were sent.
Использование
$result = Pool::batch( \YoastSEO_Vendor\GuzzleHttp\ClientInterface $client, $requests, $options );
- $client(Clientчислоerface) (обязательный)
- Client used to send the requests
- $requests(массив/\Iterator) (обязательный)
- Requests to send concurrently.
- $options(массив)
- Passes through the options available in {@see GuzzleHttp\Pool::__construct}
По умолчанию: []
Код Pool::batch() Pool::batch Yoast 15.6.2
public static function batch(\YoastSEO_Vendor\GuzzleHttp\ClientInterface $client, $requests, array $options = [])
{
$res = [];
self::cmpCallback($options, 'fulfilled', $res);
self::cmpCallback($options, 'rejected', $res);
$pool = new static($client, $requests, $options);
$pool->promise()->wait();
\ksort($res);
return $res;
}