HttpRejectedPromise
in package
implements
Promise
FinalYes
Table of Contents
Interfaces
- Promise
- Promise represents a value that may not be available yet, but will be resolved at some point in future.
Properties
Methods
- __construct() : mixed
- getState() : string
- Returns the state of the promise, one of PENDING, FULFILLED or REJECTED.
- then() : Promise
- Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).
- wait() : mixed
- Wait for the promise to be fulfilled or rejected.
Properties
$exception
private
Exception
$exception
Methods
__construct()
public
__construct(Exception $exception) : mixed
Parameters
- $exception : Exception
getState()
Returns the state of the promise, one of PENDING, FULFILLED or REJECTED.
public
getState() : string
Return values
stringthen()
Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).
public
then([callable $onFulfilled = null ][, callable $onRejected = null ]) : Promise
Parameters
- $onFulfilled : callable = null
-
called when a response will be available
- $onRejected : callable = null
-
called when an exception occurs
Return values
Promise —a new resolved promise with value of the executed callback (onFulfilled / onRejected)
wait()
Wait for the promise to be fulfilled or rejected.
public
wait([mixed $unwrap = true ]) : mixed
Parameters
- $unwrap : mixed = true
-
Whether to return resolved value / throw reason or not
Return values
mixed —Resolved value, null if $unwrap is set to false