You are here

function unwrap in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/guzzlehttp/promises/src/functions.php \GuzzleHttp\Promise\unwrap()

Waits on all of the provided promises and returns the fulfilled values.

Returns an array that contains the value of each promise (in the same order the promises were provided). An exception is thrown if any of the promises are rejected.

Parameters

mixed $promises Iterable of PromiseInterface objects to wait on.:

Return value

array

Throws

\Exception on error

File

vendor/guzzlehttp/promises/src/functions.php, line 188

Namespace

GuzzleHttp\Promise

Code

function unwrap($promises) {
  $results = [];
  foreach ($promises as $key => $promise) {
    $results[$key] = $promise
      ->wait();
  }
  return $results;
}