You are here

public function EachPromise::promise in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/promises/src/EachPromise.php \GuzzleHttp\Promise\EachPromise::promise()

Returns a promise.

Return value

PromiseInterface

Overrides PromisorInterface::promise

File

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

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 (\Exception $e) {
    $this->aggregate
      ->reject($e);
  }
  return $this->aggregate;
}