Open Journal Systems
3.3.0
|
Public Member Functions | |
getState () | |
then (callable $onFulfilled=null, callable $onRejected=null) | |
wait ($unwrap=true) | |
Data Fields | |
const | FULFILLED = 'fulfilled' |
const | PENDING = 'pending' |
const | REJECTED = 'rejected' |
Promise represents a value that may not be available yet, but will be resolved at some point in future. It acts like a proxy to the actual value.
This interface is an extension of the promises/a+ specification.
Definition at line 16 of file php-http/promise/src/Promise.php.
Http\Promise\Promise::getState | ( | ) |
Returns the state of the promise, one of PENDING, FULFILLED or REJECTED.
Implemented in Http\Adapter\Guzzle6\Promise, Http\Promise\FulfilledPromise, Http\Promise\RejectedPromise, Http\Client\Promise\HttpFulfilledPromise, and Http\Client\Promise\HttpRejectedPromise.
Http\Promise\Promise::then | ( | callable | $onFulfilled = null , |
callable | $onRejected = null |
||
) |
Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).
If you do not care about one of the cases, you can set the corresponding callable to null The callback will be called when the value arrived and never more than once.
callable | $onFulfilled | Called when a response will be available. |
callable | $onRejected | Called when an exception occurs. |
Implemented in Http\Adapter\Guzzle6\Promise, Http\Promise\FulfilledPromise, Http\Promise\RejectedPromise, Http\Client\Promise\HttpFulfilledPromise, and Http\Client\Promise\HttpRejectedPromise.
Http\Promise\Promise::wait | ( | $unwrap = true | ) |
Wait for the promise to be fulfilled or rejected.
When this method returns, the request has been resolved and if callables have been specified, the appropriate one has terminated.
When $unwrap is true (the default), the response is returned, or the exception thrown on failure. Otherwise, nothing is returned or thrown.
bool | $unwrap | Whether to return resolved value / throw reason or not |
Implemented in Http\Adapter\Guzzle6\Promise, Http\Promise\FulfilledPromise, Http\Promise\RejectedPromise, Http\Client\Promise\HttpFulfilledPromise, and Http\Client\Promise\HttpRejectedPromise.
const Http\Promise\Promise::FULFILLED = 'fulfilled' |
Promise has been fulfilled.
Definition at line 26 of file php-http/promise/src/Promise.php.
Referenced by Http\Adapter\Guzzle6\Promise\__construct(), Http\Client\Promise\HttpFulfilledPromise\getState(), and Http\Promise\FulfilledPromise\getState().
const Http\Promise\Promise::PENDING = 'pending' |
Promise has not been fulfilled or rejected.
Definition at line 21 of file php-http/promise/src/Promise.php.
Referenced by Http\Adapter\Guzzle6\Promise\__construct().
const Http\Promise\Promise::REJECTED = 'rejected' |
Promise has been rejected.
Definition at line 31 of file php-http/promise/src/Promise.php.
Referenced by Http\Adapter\Guzzle6\Promise\__construct(), Http\Client\Promise\HttpRejectedPromise\getState(), and Http\Promise\RejectedPromise\getState().