function settle in Lockr 7.3
Returns a promise that is fulfilled when all of the provided promises have been fulfilled or rejected.
The returned promise is fulfilled with an array of inspection state arrays.
Parameters
mixed $promises Promises or values.:
Return value
See also
GuzzleHttp\Promise\inspect for the inspection state array format.
File
- vendor/
guzzlehttp/ promises/ src/ functions.php, line 309
Namespace
GuzzleHttp\PromiseCode
function settle($promises) {
$results = [];
return each($promises, function ($value, $idx) use (&$results) {
$results[$idx] = [
'state' => PromiseInterface::FULFILLED,
'value' => $value,
];
}, function ($reason, $idx) use (&$results) {
$results[$idx] = [
'state' => PromiseInterface::REJECTED,
'reason' => $reason,
];
})
->then(function () use (&$results) {
ksort($results);
return $results;
});
}