$state
$state
Promises/A+ implementation that avoids recursion when possible.
then(callable $onFulfilled = null, callable $onRejected = null) : \GuzzleHttp\Promise\PromiseInterface
Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler.
callable | $onFulfilled | Invoked when the promise fulfills. |
callable | $onRejected | Invoked when the promise is rejected. |
otherwise(callable $onRejected) : \GuzzleHttp\Promise\PromiseInterface
Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled.
callable | $onRejected | Invoked when the promise is rejected. |
wait(mixed $unwrap = true) : mixed
Waits until the promise completes if possible.
Pass $unwrap as true to unwrap the result of the promise, either returning the resolved value or throwing the rejected exception.
If the promise cannot be waited on, then the promise will be rejected.
mixed | $unwrap |
callHandler(int $index, mixed $value, array $handler) : mixed
Call a stack of handlers using a specific callback index and value.
int | $index | 1 (resolve) or 2 (reject). |
mixed | $value | Value to pass to the callback. |
array | $handler | Array of handler data (promise and callbacks). |