PHP Interface Kraken\Promise\PromiseInterface

Inheritance: extends Kraken\Promise\DeferredInterface
Show file Open project: kraken-php/framework Interface Usage Examples

Public Methods

Method Description
abort ( callable $onCancel ) : Kraken\Promise\PromiseInterface Transform Promise's value by applying a function to the Promise's cancellation value. Returns a new promise for the transformed result.
always ( callable $onFulfilledOrRejected ) : Kraken\Promise\PromiseInterface Apply cleanup handler that fires regardless of Promise resolution state and suppress return value.
done ( callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null ) : null Consume the Promise's ultimate value if the promise fulfills or handle the ultimate error and cancellation.
failure ( callable $onFailure ) : Kraken\Promise\PromiseInterface Transform Promise's value by applying a function to the Promise's rejection value. Returns a new promise for the transformed result.
isCancelled ( ) : boolean Check if Promise is cancelled.
isFulfilled ( ) : boolean Check if Promise is fulfilled.
isPending ( ) : boolean Check if Promise is still pending.
isRejected ( ) : boolean Check if Promise is rejected.
spread ( callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null ) : Kraken\Promise\PromiseInterface Apply then transformation callbacks that automatically spreads received array into separate arguments.
success ( callable $onSuccess ) : Kraken\Promise\PromiseInterface Transform Promise's value by applying a function to the Promise's fulfillment value. Returns a new promise for the transformed result.
then ( callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null ) : Kraken\Promise\PromiseInterface Transform Promise's value by applying a function to the Promise's fulfillment, rejection or cancellation value.

Method Details

abort() public method

Transform Promise's value by applying a function to the Promise's cancellation value. Returns a new promise for the transformed result.
See also: PromiseInterface::then
public abort ( callable $onCancel ) : Kraken\Promise\PromiseInterface
$onCancel callable
return Kraken\Promise\PromiseInterface

always() public method

Apply cleanup handler that fires regardless of Promise resolution state and suppress return value.
See also: PromiseInterface::then
public always ( callable $onFulfilledOrRejected ) : Kraken\Promise\PromiseInterface
$onFulfilledOrRejected callable
return Kraken\Promise\PromiseInterface

done() public method

Returns null.
public done ( callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null ) : null
$onFulfilled callable
$onRejected callable
$onCancel callable
return null

failure() public method

Transform Promise's value by applying a function to the Promise's rejection value. Returns a new promise for the transformed result.
See also: PromiseInterface::then
public failure ( callable $onFailure ) : Kraken\Promise\PromiseInterface
$onFailure callable
return Kraken\Promise\PromiseInterface

isCancelled() public method

Check if Promise is cancelled.
public isCancelled ( ) : boolean
return boolean

isFulfilled() public method

Check if Promise is fulfilled.
public isFulfilled ( ) : boolean
return boolean

isPending() public method

Check if Promise is still pending.
public isPending ( ) : boolean
return boolean

isRejected() public method

Check if Promise is rejected.
public isRejected ( ) : boolean
return boolean

spread() public method

Returns a new promise for the transformed result.
See also: PromiseInterface::then
public spread ( callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null ) : Kraken\Promise\PromiseInterface
$onFulfilled callable
$onRejected callable
$onCancel callable
return Kraken\Promise\PromiseInterface

success() public method

Transform Promise's value by applying a function to the Promise's fulfillment value. Returns a new promise for the transformed result.
See also: PromiseInterface::then
public success ( callable $onSuccess ) : Kraken\Promise\PromiseInterface
$onSuccess callable
return Kraken\Promise\PromiseInterface

then() public method

Returns a new promise for the transformed result.
public then ( callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null ) : Kraken\Promise\PromiseInterface
$onFulfilled callable
$onRejected callable
$onCancel callable
return Kraken\Promise\PromiseInterface