Copied!

Promises/A+ implementation that avoids recursion when possible.

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()
public getState()
public otherwise(callable $onRejected)
public reject( $reason)
public resolve( $value)
public then(?callable $onFulfilled = NULL, ?callable $onRejected = NULL)
public wait( $unwrap = true)
Properties
private $cancelFn = NULL
private $handlers = []
private $result = NULL
private $state = 'pending'
private $waitFn = NULL
private $waitList = NULL
Methods
private static callHandler( $index, $value, array $handler)
 

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()
private invokeWaitList()
private settle( $state, $value)
private waitIfPending()
Methods
private static callHandler( $index, $value, array $handler)
 

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).
© 2023 Bruce Wells
Search Namespaces \ Classes
Configuration