CodeExplorer of example
public static function all($promises, bool
$recursive = false
): PromiseInterface
{ $results =
[];
$promise = Each::
of( $promises,
function D
$value,
$idx) use (&
$results): void
{ $results[$idx] =
$value;
},
function D
$reason,
$idx, Promise
$aggregate): void
{ $aggregate->
reject($reason);
} )->
then(function D
) use (&
$results) { ksort($results);
return $results;
});