PHP Class Kraken\Promise\Promise

Inheritance: implements Kraken\Promise\PromiseInterface, use trait Kraken\Promise\Partial\PromiseTrait
Afficher le fichier Open project: kraken-php/framework Class Usage Examples

Protected Properties

Свойство Type Description
$canceller callable
$currentCancellations integer
$handlers callable[]
$requiredCancellations integer
$result Kraken\Promise\PromiseInterface | null

Méthodes publiques

Méthode Description
__construct ( callable $resolver = null, callable $canceller = null )
__destruct ( )
abort ( callable $onCancel )
always ( callable $onFulfilledOrRejected )
cancel ( $reason = null )
done ( callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null )
failure ( callable $onFailure )
getPromise ( )
isCancelled ( )
isFulfilled ( )
isPending ( )
isRejected ( )
reject ( $reason = null )
resolve ( $value = null )
spread ( callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null )
success ( callable $onSuccess )
then ( callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null )

Méthodes protégées

Méthode Description
getReason ( ) : Erro\Error | Exceptio\Exception | string | null Return rejection or cancellation reason for Promise.
getResult ( ) : Kraken\Promise\PromiseInterface | null Get Promise result. Returns fulfilled, rejected or cancelled Promise for settled Promises or null for pending.
getValue ( ) : mixed | null Return primitive value associated with Promise.
mutate ( callable $resolver = null ) Mutate resolver.
settle ( Kraken\Promise\PromiseInterface $promise ) : Kraken\Promise\PromiseInterface Settle Promise with another Promise.

Method Details

__construct() public méthode

public __construct ( callable $resolver = null, callable $canceller = null )
$resolver callable
$canceller callable

__destruct() public méthode

public __destruct ( )

abort() public méthode

public abort ( callable $onCancel )
$onCancel callable

always() public méthode

public always ( callable $onFulfilledOrRejected )
$onFulfilledOrRejected callable

cancel() public méthode

public cancel ( $reason = null )

done() public méthode

public done ( callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null )
$onFulfilled callable
$onRejected callable
$onCancel callable

failure() public méthode

public failure ( callable $onFailure )
$onFailure callable

getPromise() public méthode

public getPromise ( )

getReason() protected méthode

Return rejection or cancellation reason for Promise.
protected getReason ( ) : Erro\Error | Exceptio\Exception | string | null
Résultat Erro\Error | Exceptio\Exception | string | null

getResult() protected méthode

Get Promise result. Returns fulfilled, rejected or cancelled Promise for settled Promises or null for pending.
protected getResult ( ) : Kraken\Promise\PromiseInterface | null
Résultat Kraken\Promise\PromiseInterface | null

getValue() protected méthode

Return primitive value associated with Promise.
protected getValue ( ) : mixed | null
Résultat mixed | null

isCancelled() public méthode

public isCancelled ( )

isFulfilled() public méthode

public isFulfilled ( )

isPending() public méthode

public isPending ( )

isRejected() public méthode

public isRejected ( )

mutate() protected méthode

Mutate resolver.
protected mutate ( callable $resolver = null )
$resolver callable

reject() public méthode

public reject ( $reason = null )

resolve() public méthode

public resolve ( $value = null )

settle() protected méthode

Settle Promise with another Promise.
See also: PromiseInterface::resolve
See also: PromiseInterface::reject
See also: PromiseInterface::cancel
protected settle ( Kraken\Promise\PromiseInterface $promise ) : Kraken\Promise\PromiseInterface
$promise Kraken\Promise\PromiseInterface
Résultat Kraken\Promise\PromiseInterface

spread() public méthode

public spread ( callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null )
$onFulfilled callable
$onRejected callable
$onCancel callable

success() public méthode

public success ( callable $onSuccess )
$onSuccess callable

then() public méthode

public then ( callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null )
$onFulfilled callable
$onRejected callable
$onCancel callable

Property Details

$canceller protected_oe property

protected callable $canceller
Résultat callable

$currentCancellations protected_oe property

protected int $currentCancellations
Résultat integer

$handlers protected_oe property

protected callable[] $handlers
Résultat callable[]

$requiredCancellations protected_oe property

protected int $requiredCancellations
Résultat integer

$result protected_oe property

protected PromiseInterface,Kraken\Promise|null $result
Résultat Kraken\Promise\PromiseInterface | null