Skip to content

Latest commit

 

History

History
330 lines (115 loc) · 2.77 KB

EachPromise.md

File metadata and controls

330 lines (115 loc) · 2.77 KB

EachPromise

Represents a promise that iterates over many promises and invokes side-effect functions in the process.

Properties

pending

private $pending

nextPendingIndex

private $nextPendingIndex

iterable

private \Iterator|null $iterable

concurrency

private callable|int|null $concurrency

onFulfilled

private callable|null $onFulfilled

onRejected

private callable|null $onRejected

aggregate

private \GuzzleHttp\Promise\Promise|null $aggregate

mutex

private bool|null $mutex

Methods

__construct

Configuration hash can include the following key value pairs:

public __construct(mixed $iterable, array $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:

Parameter Type Description
$iterable mixed Promises or values to iterate.
$config array Configuration options

promise

Returns a promise.

public promise(): \GuzzleHttp\Promise\PromiseInterface

createPromise

private createPromise(): mixed

refillPending

private refillPending(): mixed

addPending

private addPending(): mixed

advanceIterator

private advanceIterator(): mixed

step

private step(mixed $idx): mixed

Parameters:

Parameter Type Description
$idx mixed

checkIfFinished

private checkIfFinished(): mixed