PHP Class SparkPost\SparkPostPromise

Inheritance: implements Http\Promise\Promise
Show file Open project: sparkpost/php-sparkpost Class Usage Examples

Public Methods

Method Description
__construct ( Http\Promise\Promise $promise ) set the promise to be wrapped.
getState ( ) Hand back the state.
then ( callable $onFulfilled = null, callable $onRejected = null ) Hand off the response functions to the original promise and return a custom response or exception.
wait ( boolean $unwrap = true ) : SparkPostResponse Wraps the wait function and returns a custom response or throws a custom exception.

Method Details

__construct() public method

set the promise to be wrapped.
public __construct ( Http\Promise\Promise $promise )
$promise Http\Promise\Promise

getState() public method

Hand back the state.
public getState ( )

then() public method

Hand off the response functions to the original promise and return a custom response or exception.
public then ( callable $onFulfilled = null, callable $onRejected = null )
$onFulfilled callable - function to be called if the promise is fulfilled
$onRejected callable - function to be called if the promise is rejected

wait() public method

Wraps the wait function and returns a custom response or throws a custom exception.
public wait ( boolean $unwrap = true ) : SparkPostResponse
$unwrap boolean
return SparkPostResponse