You are here

private function EachPromise::addPending in Auth0 Single Sign On 8.2

1 call to EachPromise::addPending()
EachPromise::refillPending in vendor/guzzlehttp/promises/src/EachPromise.php

File

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

Class

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

Namespace

GuzzleHttp\Promise

Code

private function addPending() {
  if (!$this->iterable || !$this->iterable
    ->valid()) {
    return false;
  }
  $promise = promise_for($this->iterable
    ->current());
  $idx = $this->iterable
    ->key();
  $this->pending[$idx] = $promise
    ->then(function ($value) use ($idx) {
    if ($this->onFulfilled) {
      call_user_func($this->onFulfilled, $value, $idx, $this->aggregate);
    }
    $this
      ->step($idx);
  }, function ($reason) use ($idx) {
    if ($this->onRejected) {
      call_user_func($this->onRejected, $reason, $idx, $this->aggregate);
    }
    $this
      ->step($idx);
  });
  return true;
}