EachPromise
in package
implements
PromisorInterface
Represents a promise that iterates over many promises and invokes side-effect functions in the process.
Interfaces, Classes and Traits
- PromisorInterface
- Interface used with classes that return a promise.
Table of Contents
- $aggregate : Promise|null
- $concurrency : callable|int|null
- $iterable : Iterator|null
- $mutex : bool|null
- $nextPendingIndex : mixed
- $onFulfilled : callable|null
- $onRejected : callable|null
- $pending : mixed
- __construct() : mixed
- Configuration hash can include the following key value pairs:
- promise() : PromiseInterface
- Returns a promise.
- addPending() : mixed
- advanceIterator() : mixed
- checkIfFinished() : mixed
- createPromise() : mixed
- refillPending() : mixed
- step() : mixed
Properties
$aggregate
private
Promise|null
$aggregate
$concurrency
private
callable|int|null
$concurrency
$iterable
private
Iterator|null
$iterable
$mutex
private
bool|null
$mutex
$nextPendingIndex
private
mixed
$nextPendingIndex
= 0
$onFulfilled
private
callable|null
$onFulfilled
$onRejected
private
callable|null
$onRejected
$pending
private
mixed
$pending
= []
Methods
__construct()
Configuration hash can include the following key value pairs:
public
__construct(mixed $iterable[, array<string|int, mixed> $config = [] ]) : mixed
- 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<string|int, mixed> = []
-
Configuration options
Return values
mixed —promise()
Returns a promise.
public
promise() : PromiseInterface
Tags
Return values
PromiseInterface —addPending()
private
addPending() : mixed
Return values
mixed —advanceIterator()
private
advanceIterator() : mixed
Return values
mixed —checkIfFinished()
private
checkIfFinished() : mixed
Return values
mixed —createPromise()
private
createPromise() : mixed
Return values
mixed —refillPending()
private
refillPending() : mixed
Return values
mixed —step()
private
step(mixed $idx) : mixed
Parameters
- $idx : mixed