EachPromise

class Firstred\PostNL\Util\EachPromise
Represents a promise that iterates over many promises and invokes
side-effect functions in the process.

Summary

Methods

Constants

PENDING = \'pending\'
FULFILLED = \'fulfilled\'
REJECTED = \'rejected\'

Properties

private static property Firstred\PostNL\Util\EachPromise::$pending
private static property Firstred\PostNL\Util\EachPromise::$iterable
Type:

\Iterator

private static property Firstred\PostNL\Util\EachPromise::$concurrency
Type:

callable | int

private static property Firstred\PostNL\Util\EachPromise::$onFulfilled
Type:

callable

private static property Firstred\PostNL\Util\EachPromise::$onRejected
Type:

callable

private static property Firstred\PostNL\Util\EachPromise::$aggregate
Type:

\Http\Promise\Promise

private static property Firstred\PostNL\Util\EachPromise::$mutex
Type:

bool

Methods

public Firstred\PostNL\Util\EachPromise::__construct( $iterable, $config=\[\])
Configuration hash can include the following key value pairs:.
- fulfilled: (callable) Invoked when a promise fulfills. The function
is invoked with three arguments: the fulfillment value, the index
position from the iterable list of the promise, and the aggregate
promise that manages all of the promises. The aggregate promise may
be resolved from within the callback to short-circuit the promise.
- rejected: (callable) Invoked when a promise is rejected. The
function is invoked with three arguments: the rejection reason, the
index position from the iterable list of the promise, and the
aggregate promise that manages all of the promises. The aggregate
promise may be resolved from within the callback to short-circuit
the promise.
- concurrency: (integer) Pass this configuration option to limit the
allowed number of outstanding concurrently executing promises,
creating a capped pool of promises. There is no limit by default.
Parameters:
  • $iterable (mixed) promises or values to iterate

  • $config (array) Configuration options

public Firstred\PostNL\Util\EachPromise::promise()
Returns:

\Http\Promise\Promise

private Firstred\PostNL\Util\EachPromise::createPromise()
Returns:

void

private Firstred\PostNL\Util\EachPromise::refillPending()
Returns:

void

private Firstred\PostNL\Util\EachPromise::addPending()
Returns:

bool

private Firstred\PostNL\Util\EachPromise::advanceIterator()
Returns:

bool

private Firstred\PostNL\Util\EachPromise::step($idx)
Parameters:
  • $idx (mixed)

private Firstred\PostNL\Util\EachPromise::checkIfFinished()
Returns:

bool