function Utils::queue
Get the global task queue used for promise resolution.
This task queue MUST be run in an event loop in order for promises to be settled asynchronously. It will be automatically run when synchronously waiting on a promise.
<code> while ($eventLoop->isRunning()) { GuzzleHttp\Promise\Utils::queue()->run(); } </code>
Parameters
TaskQueueInterface|null $assign Optionally specify a new queue instance.:
3 calls to Utils::queue()
- FulfilledPromise::then in vendor/
guzzlehttp/ promises/ src/ FulfilledPromise.php - Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler.
- RejectedPromise::then in vendor/
guzzlehttp/ promises/ src/ RejectedPromise.php - Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler.
- Utils::task in vendor/
guzzlehttp/ promises/ src/ Utils.php - Adds a function to run in the task queue when it is next `run()` and returns a promise that is fulfilled or rejected with the result.
File
-
vendor/
guzzlehttp/ promises/ src/ Utils.php, line 24
Class
Namespace
GuzzleHttp\PromiseCode
public static function queue(?TaskQueueInterface $assign = null) : TaskQueueInterface {
static $queue;
if ($assign) {
$queue = $assign;
}
elseif (!$queue) {
$queue = new TaskQueue();
}
return $queue;
}