PHP Trait Kraken\Promise\Partial\PromiseTrait

Exibir arquivo Open project: kraken-php/framework

Public Methods

Method Description
all ( Kraken\Promise\PromiseInterface[] | mixed[] $promisesOrValues ) : Kraken\Promise\PromiseInterface Return Promise that will resolve only once all the items in $promisesOrValues have resolved.
any ( Kraken\Promise\PromiseInterface[] | mixed[] $promisesOrValues ) : Kraken\Promise\PromiseInterface Return a promise that will resolve when any one of the items in $promisesOrValues resolves.
doCancel ( Kraken\Promise\PromiseInterface | mixed $promiseOrValue = null ) : Kraken\Promise\PromiseInterface Cancel Promise or value.
doReject ( Kraken\Promise\PromiseInterface | mixed $promiseOrValue = null ) : Kraken\Promise\PromiseInterface Reject Promise or value.
doResolve ( Kraken\Promise\PromiseInterface | mixed $promiseOrValue = null ) : Kraken\Promise\PromiseInterface Resolve Promise or value.
map ( Kraken\Promise\PromiseInterface[] | mixed[] $promisesOrValues, callable $mapFunc ) : Kraken\Promise\PromiseInterface Map promises and/or values using specified $mapFunc.
race ( Kraken\Promise\PromiseInterface[] | mixed[] $promisesOrValues ) : Kraken\Promise\PromiseInterface Initiate a competitive race that allows one winner.
reduce ( Kraken\Promise\PromiseInterface[] | mixed[] $promisesOrValues, callable $reduceFunc, Kraken\Promise\PromiseInterface | mixed | null $initialValue = null ) : Kraken\Promise\PromiseInterface Reduce Promises and/or values using $reduceFunc with $initialValue being Promise or primitive value.
some ( Kraken\Promise\PromiseInterface[] | mixed[] $promisesOrValues, integer $howMany ) : Kraken\Promise\PromiseInterface Return Promise that will resolve when $howMany of the supplied items in $promisesOrValues resolve.

Method Details

all() public static method

Return Promise that will resolve only once all the items in $promisesOrValues have resolved. The resolution value of the returned promise will be an array containing the resolution values of each of the items in $promisesOrValues.
public static all ( Kraken\Promise\PromiseInterface[] | mixed[] $promisesOrValues ) : Kraken\Promise\PromiseInterface
$promisesOrValues Kraken\Promise\PromiseInterface[] | mixed[]
return Kraken\Promise\PromiseInterface

any() public static method

Return a promise that will resolve when any one of the items in $promisesOrValues resolves. The resolution value of the returned promise will be the resolution value of the triggering item.
public static any ( Kraken\Promise\PromiseInterface[] | mixed[] $promisesOrValues ) : Kraken\Promise\PromiseInterface
$promisesOrValues Kraken\Promise\PromiseInterface[] | mixed[]
return Kraken\Promise\PromiseInterface

doCancel() public static method

Cancel Promise or value.
public static doCancel ( Kraken\Promise\PromiseInterface | mixed $promiseOrValue = null ) : Kraken\Promise\PromiseInterface
$promiseOrValue Kraken\Promise\PromiseInterface | mixed
return Kraken\Promise\PromiseInterface

doReject() public static method

Reject Promise or value.
public static doReject ( Kraken\Promise\PromiseInterface | mixed $promiseOrValue = null ) : Kraken\Promise\PromiseInterface
$promiseOrValue Kraken\Promise\PromiseInterface | mixed
return Kraken\Promise\PromiseInterface

doResolve() public static method

Resolve Promise or value.
public static doResolve ( Kraken\Promise\PromiseInterface | mixed $promiseOrValue = null ) : Kraken\Promise\PromiseInterface
$promiseOrValue Kraken\Promise\PromiseInterface | mixed
return Kraken\Promise\PromiseInterface

map() public static method

Map promises and/or values using specified $mapFunc.
See also: array_map
public static map ( Kraken\Promise\PromiseInterface[] | mixed[] $promisesOrValues, callable $mapFunc ) : Kraken\Promise\PromiseInterface
$promisesOrValues Kraken\Promise\PromiseInterface[] | mixed[]
$mapFunc callable
return Kraken\Promise\PromiseInterface

race() public static method

Initiate a competitive race that allows one winner. Returns a promise which is resolved in the same way the first settled promise resolves.
public static race ( Kraken\Promise\PromiseInterface[] | mixed[] $promisesOrValues ) : Kraken\Promise\PromiseInterface
$promisesOrValues Kraken\Promise\PromiseInterface[] | mixed[]
return Kraken\Promise\PromiseInterface

reduce() public static method

Reduce Promises and/or values using $reduceFunc with $initialValue being Promise or primitive value.
See also: array_reduce
public static reduce ( Kraken\Promise\PromiseInterface[] | mixed[] $promisesOrValues, callable $reduceFunc, Kraken\Promise\PromiseInterface | mixed | null $initialValue = null ) : Kraken\Promise\PromiseInterface
$promisesOrValues Kraken\Promise\PromiseInterface[] | mixed[]
$reduceFunc callable
$initialValue Kraken\Promise\PromiseInterface | mixed | null
return Kraken\Promise\PromiseInterface

some() public static method

Return Promise that will resolve when $howMany of the supplied items in $promisesOrValues resolve. The resolution value of the returned promise will be an array of length $howMany containing the resolution values of the triggering items.
public static some ( Kraken\Promise\PromiseInterface[] | mixed[] $promisesOrValues, integer $howMany ) : Kraken\Promise\PromiseInterface
$promisesOrValues Kraken\Promise\PromiseInterface[] | mixed[]
$howMany integer
return Kraken\Promise\PromiseInterface