function all
Returns a promise that will resolve only once all the items in `$promisesOrValues` have resolved. The resolution value of the returned promise will be an array containing the resolution values of each of the items in `$promisesOrValues`.
@template T
Parameters
iterable<PromiseInterface<T>|T> $promisesOrValues:
Return value
PromiseInterface<array<T>>
95 string references to 'all'
- AnnotationHelper::getAnnotations in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Helpers/ AnnotationHelper.php - *
- ArgumentPluginBase::defineOptions in core/
modules/ views/ src/ Plugin/ views/ argument/ ArgumentPluginBase.php - Information about options for all kinds of purposes will be held here.
- ArgumentPluginBase::defineOptions in core/
modules/ views/ src/ Plugin/ views/ argument/ ArgumentPluginBase.php - Information about options for all kinds of purposes will be held here.
- Assert::__callStatic in vendor/
webmozart/ assert/ src/ Assert.php - AssetResolver::getCssAssets in core/
lib/ Drupal/ Core/ Asset/ AssetResolver.php - Returns the CSS assets for the current response's libraries.
File
-
vendor/
react/ promise/ src/ functions.php, line 77
Namespace
React\PromiseCode
function all(iterable $promisesOrValues) : PromiseInterface {
$cancellationQueue = new Internal\CancellationQueue();
/** @var Promise<array<T>> */
return new Promise(function (callable $resolve, callable $reject) use ($promisesOrValues, $cancellationQueue) : void {
$toResolve = 0;
/** @var bool */
$continue = true;
$values = [];
foreach ($promisesOrValues as $i => $promiseOrValue) {
$cancellationQueue->enqueue($promiseOrValue);
$values[$i] = null;
++$toResolve;
resolve($promiseOrValue)->then(function ($value) use ($i, &$values, &$toResolve, &$continue, $resolve) : void {
$values[$i] = $value;
if (0 === --$toResolve && !$continue) {
$resolve($values);
}
}, function (\Throwable $reason) use (&$continue, $reject) : void {
$continue = false;
$reject($reason);
});
if (!$continue && !\is_array($promisesOrValues)) {
break;
}
}
$continue = false;
if ($toResolve === 0) {
$resolve($values);
}
}, $cancellationQueue);
}