YoastSEO_Vendor\GuzzleHttp
Pool::__construct() public Yoast 1.0
{} Это метод класса: Pool{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$Pool = new Pool(); $Pool->__construct( \YoastSEO_Vendor\GuzzleHttp\ClientInterface $client, $requests, $config );
- $client(Clientчислоerface) (обязательный)
- Client used to send the requests.
- $requests(массив/\Iterator) (обязательный)
- Requests or functions that return requests to send concurrently.
- $config(массив)
Associative 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.
По умолчанию: []
Код Pool::__construct() Pool:: construct Yoast 15.6.2
public function __construct(\YoastSEO_Vendor\GuzzleHttp\ClientInterface $client, $requests, array $config = [])
{
// Backwards compatibility.
if (isset($config['pool_size'])) {
$config['concurrency'] = $config['pool_size'];
} elseif (!isset($config['concurrency'])) {
$config['concurrency'] = 25;
}
if (isset($config['options'])) {
$opts = $config['options'];
unset($config['options']);
} else {
$opts = [];
}
$iterable = \YoastSEO_Vendor\GuzzleHttp\Promise\iter_for($requests);
$requests = function () use($iterable, $client, $opts) {
foreach ($iterable as $key => $rfn) {
if ($rfn instanceof \YoastSEO_Vendor\Psr\Http\Message\RequestInterface) {
(yield $key => $client->sendAsync($rfn, $opts));
} elseif (\is_callable($rfn)) {
(yield $key => $rfn($opts));
} else {
throw new \InvalidArgumentException('Each value yielded by ' . 'the iterator must be a Psr7\\Http\\Message\\RequestInterface ' . 'or a callable that returns a promise that fulfills ' . 'with a Psr7\\Message\\Http\\ResponseInterface object.');
}
}
};
$this->each = new \YoastSEO_Vendor\GuzzleHttp\Promise\EachPromise($requests(), $config);
}