EachPromise
- class Firstred\PostNL\Util\EachPromise
- Represents a promise that iterates over many promises and invokesside-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 functionis invoked with three arguments: the fulfillment value, the indexposition from the iterable list of the promise, and the aggregatepromise that manages all of the promises. The aggregate promise maybe resolved from within the callback to short-circuit the promise.- rejected: (callable) Invoked when a promise is rejected. Thefunction is invoked with three arguments: the rejection reason, theindex position from the iterable list of the promise, and theaggregate promise that manages all of the promises. The aggregatepromise may be resolved from within the callback to short-circuitthe promise.- concurrency: (integer) Pass this configuration option to limit theallowed 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