SDK for PHP V3

Each
in package

FinalYes

Table of Contents

Methods

of()  : PromiseInterface<mixed, mixed>
Given an iterator that yields promises or values, returns a promise that is fulfilled with a null value when the iterator has been consumed or the aggregate promise has been fulfilled or rejected.
ofLimit()  : PromiseInterface<mixed, mixed>
Like of, but only allows a certain number of outstanding promises at any given time.
ofLimitAll()  : PromiseInterface<mixed, mixed>
Like ofLimit, but rejects the aggregate promise on the first rejection.

Methods

of()

Given an iterator that yields promises or values, returns a promise that is fulfilled with a null value when the iterator has been consumed or the aggregate promise has been fulfilled or rejected.

public static of(iterable<TKey, TValue|PromiseInterface<TValue, TReason>> $iterable[, callable(TValue, TKey, PromiseInterface<mixed, mixed>): mixed|null $onFulfilled = null ][, callable(TReason, TKey, PromiseInterface<mixed, mixed>): mixed|null $onRejected = null ][, array{concurrency?: int|callable} $config = [] ]) : PromiseInterface<mixed, mixed>

$onFulfilled is a function that accepts the fulfilled value, iterable key, and the aggregate promise. The callback can invoke any necessary side effects and choose to resolve or reject the aggregate if needed.

$onRejected is a function that accepts the rejection reason, iterable key, and the aggregate promise. The callback can invoke any necessary side effects and choose to resolve or reject the aggregate if needed.

The config array accepts a concurrency option matching ofLimit. Other config keys are ignored by this wrapper.

Parameters
$iterable : iterable<TKey, TValue|PromiseInterface<TValue, TReason>>

Iterator or array to iterate over.

$onFulfilled : callable(TValue, TKey, PromiseInterface<mixed, mixed>): mixed|null = null
$onRejected : callable(TReason, TKey, PromiseInterface<mixed, mixed>): mixed|null = null
$config : array{concurrency?: int|callable} = []

Configuration options.

Tags
template

TKey of array-key

template

TValue

template

TReason

Return values
PromiseInterface<mixed, mixed>

ofLimit()

Like of, but only allows a certain number of outstanding promises at any given time.

public static ofLimit(iterable<TKey, TValue|PromiseInterface<TValue, TReason>> $iterable, int|callable(int): int $concurrency[, callable(TValue, TKey, PromiseInterface<mixed, mixed>): mixed|null $onFulfilled = null ][, callable(TReason, TKey, PromiseInterface<mixed, mixed>): mixed|null $onRejected = null ]) : PromiseInterface<mixed, mixed>

$concurrency may be an integer or a function that accepts the number of pending promises and returns a numeric concurrency limit value to allow for a dynamic concurrency size.

Parameters
$iterable : iterable<TKey, TValue|PromiseInterface<TValue, TReason>>
$concurrency : int|callable(int): int
$onFulfilled : callable(TValue, TKey, PromiseInterface<mixed, mixed>): mixed|null = null
$onRejected : callable(TReason, TKey, PromiseInterface<mixed, mixed>): mixed|null = null
Tags
template

TKey of array-key

template

TValue

template

TReason

Return values
PromiseInterface<mixed, mixed>

ofLimitAll()

Like ofLimit, but rejects the aggregate promise on the first rejection.

public static ofLimitAll(iterable<TKey, TValue|PromiseInterface<TValue, TReason>> $iterable, int|callable(int): int $concurrency[, callable(TValue, TKey, PromiseInterface<mixed, mixed>): mixed|null $onFulfilled = null ]) : PromiseInterface<mixed, mixed>
Parameters
$iterable : iterable<TKey, TValue|PromiseInterface<TValue, TReason>>
$concurrency : int|callable(int): int
$onFulfilled : callable(TValue, TKey, PromiseInterface<mixed, mixed>): mixed|null = null
Tags
template

TKey of array-key

template

TValue

template

TReason

Return values
PromiseInterface<mixed, mixed>
<-- modeled_exceptions -->
On this page