You are here

function unwrap in Lockr 7.3

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

\Throwable on error in PHP >=7

File

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

Namespace

GuzzleHttp\Promise

Code

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