You are here

private function Promise::waitIfPending in Auth0 Single Sign On 8.2

1 call to Promise::waitIfPending()
Promise::wait in vendor/guzzlehttp/promises/src/Promise.php
Waits until the promise completes if possible.

File

vendor/guzzlehttp/promises/src/Promise.php, line 218

Class

Promise
Promises/A+ implementation that avoids recursion when possible.

Namespace

GuzzleHttp\Promise

Code

private function waitIfPending() {
  if ($this->state !== self::PENDING) {
    return;
  }
  elseif ($this->waitFn) {
    $this
      ->invokeWaitFn();
  }
  elseif ($this->waitList) {
    $this
      ->invokeWaitList();
  }
  else {

    // If there's not wait function, then reject the promise.
    $this
      ->reject('Cannot wait on a promise that has ' . 'no internal wait function. You must provide a wait ' . 'function when constructing the promise to be able to ' . 'wait on a promise.');
  }
  queue()
    ->run();
  if ($this->state === self::PENDING) {
    $this
      ->reject('Invoking the wait callback did not resolve the promise');
  }
}