Copied!

Promises/A+ implementation that avoids recursion when possible.

  • see https://promisesaplus.com/
  • final
CloneableInstantiable
Constants
public GuzzleHttp\Promise\PromiseInterface::FULFILLED = 'fulfilled'
public GuzzleHttp\Promise\PromiseInterface::PENDING = 'pending'
public GuzzleHttp\Promise\PromiseInterface::REJECTED = 'rejected'
Methods
public __construct(?callable $waitFn = NULL, ?callable $cancelFn = NULL)
 
  • param callable $waitFn Fn that when invoked resolves the promise.
  • param callable $cancelFn Fn that when invoked cancels the promise.
public cancel() : void
public getState() : string
public otherwise(callable $onRejected) : GuzzleHttp\Promise\PromiseInterface
public reject( $reason) : void
public resolve( $value) : void
public then(?callable $onFulfilled = NULL, ?callable $onRejected = NULL) : GuzzleHttp\Promise\PromiseInterface
public wait(bool $unwrap = true)
Properties
private $cancelFn = NULL
private $handlers = []
private $result = NULL
private $state = 'pending'
private $waitFn = NULL
private $waitList = NULL
Methods
private static callHandler(int $index, $value, array $handler) : void
 

Call a stack of handlers using a specific callback index and value.

  • param int $index 1 (resolve) or 2 (reject).
  • param mixed $value Value to pass to the callback.
  • param array $handler Array of handler data (promise and callbacks).
private invokeWaitFn() : void
private invokeWaitList() : void
private settle(string $state, $value) : void
private waitIfPending() : void
Methods
private static callHandler(int $index, $value, array $handler) : void
 

Call a stack of handlers using a specific callback index and value.

  • param int $index 1 (resolve) or 2 (reject).
  • param mixed $value Value to pass to the callback.
  • param array $handler Array of handler data (promise and callbacks).
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration