You are here

public function EachPromise::promise in Auth0 Single Sign On 8.2

Returns a promise.

Return value

PromiseInterface

Overrides PromisorInterface::promise

File

vendor/guzzlehttp/promises/src/EachPromise.php, line 68

Class

EachPromise
Represents a promise that iterates over many promises and invokes side-effect functions in the process.

Namespace

GuzzleHttp\Promise

Code

public function promise() {
  if ($this->aggregate) {
    return $this->aggregate;
  }
  try {
    $this
      ->createPromise();
    $this->iterable
      ->rewind();
    $this
      ->refillPending();
  } catch (\Throwable $e) {
    $this->aggregate
      ->reject($e);
  } catch (\Exception $e) {
    $this->aggregate
      ->reject($e);
  }
  return $this->aggregate;
}