|
| __construct ($reason) |
|
| cancel () |
| Cancels the promise if possible.
|
|
| getState () |
| Get the state of the promise ("pending", "rejected", or "fulfilled").
|
|
| otherwise (callable $onRejected) |
| 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.
|
|
| reject ($reason) |
| Reject the promise with the given reason.
|
|
| resolve ($value) |
| Resolve the promise with the given value.
|
|
| then (callable $onFulfilled=null, callable $onRejected=null) |
| Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler.
|
|
| wait (bool $unwrap=true) |
| Waits until the promise completes if possible.
|
|
|
const | FULFILLED = 'fulfilled' |
|
const | PENDING = 'pending' |
|
const | REJECTED = 'rejected' |
|
◆ __construct()
GuzzleHttp\Promise\RejectedPromise::__construct |
( |
| $reason | ) |
|
◆ cancel()
GuzzleHttp\Promise\RejectedPromise::cancel |
( |
| ) |
|
◆ getState()
GuzzleHttp\Promise\RejectedPromise::getState |
( |
| ) |
|
Get the state of the promise ("pending", "rejected", or "fulfilled").
The three states can be checked against the constants defined on PromiseInterface: PENDING, FULFILLED, and REJECTED.
Implements GuzzleHttp\Promise\PromiseInterface.
◆ otherwise()
GuzzleHttp\Promise\RejectedPromise::otherwise |
( |
callable | $onRejected | ) |
|
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.
- Parameters
-
callable | $onRejected | Invoked when the promise is rejected. |
Implements GuzzleHttp\Promise\PromiseInterface.
◆ reject()
GuzzleHttp\Promise\RejectedPromise::reject |
( |
| $reason | ) |
|
◆ resolve()
GuzzleHttp\Promise\RejectedPromise::resolve |
( |
| $value | ) |
|
◆ then()
GuzzleHttp\Promise\RejectedPromise::then |
( |
callable | $onFulfilled = null, |
|
|
callable | $onRejected = null ) |
Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler.
- Parameters
-
callable | $onFulfilled | Invoked when the promise fulfills. |
callable | $onRejected | Invoked when the promise is rejected. |
Implements GuzzleHttp\Promise\PromiseInterface.
◆ wait()
GuzzleHttp\Promise\RejectedPromise::wait |
( |
bool | $unwrap = true | ) |
|
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.
- Return values
-
- Exceptions
-
LogicException | if the promise has no wait function or if the promise does not settle after waiting. |
Implements GuzzleHttp\Promise\PromiseInterface.
The documentation for this class was generated from the following file:
- lib/guzzlehttp/promises/src/RejectedPromise.php