Documentation

Pipeline
in package
implements IteratorAggregate

FinalYes

A pipeline represents an asynchronous set and provides operations which can be applied over the set.

Tags
template
template-implements

Table of Contents

Interfaces

IteratorAggregate

Properties

$bufferSize  : int
$concurrency  : positive-int
$intermediateOperations  : array<int, IntermediateOperation>
$ordered  : bool
$source  : ConcurrentIterator
$used  : bool

Methods

__construct()  : mixed
__destruct()  : mixed
allMatch()  : bool
anyMatch()  : bool
buffer()  : self
concat()  : Ts>
Concatenates the given iterables into a single pipeline in sequential order.
concurrent()  : self
count()  : int
delay()  : T>
Delays each item by $delay seconds.
dispose()  : void
filter()  : T>
Filters values.
flatMap()  : R>
Maps values, flattening one level.
forEach()  : void
Invokes the given callback for each value emitted on the pipeline.
fromIterable()  : Ts>
Creates a pipeline from the given iterable or closure returning an iterable.
generate()  : Ts>
Creates an infinite pipeline from the given closure invoking it repeatedly for each value.
getIterator()  : ConcurrentIterator<string|int, T>
map()  : R>
Maps values.
max()  : T|R
merge()  : Ts>
Merges the given iterables into a single pipeline. The returned pipeline emits a value anytime one of the merged iterables produces a value.
min()  : T|R
noneMatch()  : bool
ordered()  : self
reduce()  : R
sequential()  : self
skip()  : T>
Skip the first N items of the pipeline.
skipWhile()  : T>
Skips values on the pipeline until {@code $predicate} returns {@code false}.
sorted()  : R>
Sorts values, requires buffering all values.
take()  : T>
Take only the first N items of the pipeline.
takeWhile()  : T>
Takes values on the pipeline until {@code $predicate} returns {@code false}.
tap()  : T>
Invokes the given function each time a value is streamed through the pipeline to perform side effects.
toArray()  : array<int, T>
Collects all items into an array.
unordered()  : self
mapToConcurrentIterators()  : array<string|int, mixed>

Properties

$bufferSize

private int $bufferSize = 0

non-negative-int

$concurrency

private positive-int $concurrency = 1

$intermediateOperations

private array<int, IntermediateOperation> $intermediateOperations = []

Methods

__destruct()

public __destruct() : mixed

allMatch()

public allMatch(callable(T): bool $predicate) : bool
Parameters
$predicate : callable(T): bool
Return values
bool

anyMatch()

public anyMatch(callable(T): bool $predicate) : bool
Parameters
$predicate : callable(T): bool
Return values
bool

buffer()

public buffer(int $bufferSize) : self
Parameters
$bufferSize : int
Return values
self

concat()

Concatenates the given iterables into a single pipeline in sequential order.

public static concat(array<string|int, iterable<string|int, Ts>> $pipelines) : Ts>

The prior pipeline must complete before values are taken from any subsequent pipelines.

Parameters
$pipelines : array<string|int, iterable<string|int, Ts>>
Tags
template
Return values
Ts>

concurrent()

public concurrent(int $concurrency) : self
Parameters
$concurrency : int
Return values
self

count()

public count() : int
Return values
int

delay()

Delays each item by $delay seconds.

public delay(float $delay) : T>
Parameters
$delay : float
Return values
T>

filter()

Filters values.

public filter(callable(T): bool $filter) : T>
Parameters
$filter : callable(T): bool

Keep value if $filter returns true.

Return values
T>

flatMap()

Maps values, flattening one level.

public flatMap(callable(T, int): iterable<string|int, R$flatMap) : R>
Parameters
$flatMap : callable(T, int): iterable<string|int, R>
Tags
template
Return values
R>

forEach()

Invokes the given callback for each value emitted on the pipeline.

public forEach(callable(T): void $forEach) : void
Parameters
$forEach : callable(T): void

fromIterable()

Creates a pipeline from the given iterable or closure returning an iterable.

public static fromIterable(callable(): iterable<string|int, Ts>|iterable<string|int, Ts$iterable) : Ts>
Parameters
$iterable : callable(): iterable<string|int, Ts>|iterable<string|int, Ts>
Tags
template
Return values
Ts>

generate()

Creates an infinite pipeline from the given closure invoking it repeatedly for each value.

public static generate(callable(Cancellation): Ts $supplier) : Ts>
Parameters
$supplier : callable(Cancellation): Ts

Elements to emit.

Tags
template
Return values
Ts>

map()

Maps values.

public map(callable(T): R $map) : R>
Parameters
$map : callable(T): R
Tags
template
Return values
R>

max()

public max([null|callable(T, T): int $compare = null ][, R $default = null ]) : T|R
Parameters
$compare : null|callable(T, T): int = null
$default : R = null
Tags
template
Return values
T|R

merge()

Merges the given iterables into a single pipeline. The returned pipeline emits a value anytime one of the merged iterables produces a value.

public static merge(array<string|int, iterable<string|int, Ts>> $pipelines) : Ts>
Parameters
$pipelines : array<string|int, iterable<string|int, Ts>>

f

Tags
template
Return values
Ts>

min()

public min([null|callable(T, T): int $compare = null ][, R $default = null ]) : T|R
Parameters
$compare : null|callable(T, T): int = null
$default : R = null
Tags
template
Return values
T|R

noneMatch()

public noneMatch(callable(T): bool $predicate) : bool
Parameters
$predicate : callable(T): bool
Return values
bool

ordered()

public ordered() : self
Return values
self

reduce()

public reduce(callable(R, T): R $accumulator[, R $initial = null ]) : R
Parameters
$accumulator : callable(R, T): R
$initial : R = null
Tags
template
Return values
R

sequential()

public sequential() : self
Return values
self

skip()

Skip the first N items of the pipeline.

public skip(int $count) : T>
Parameters
$count : int
Return values
T>

skipWhile()

Skips values on the pipeline until {@code $predicate} returns {@code false}.

public skipWhile(callable(T): bool $predicate) : T>

All values are emitted afterwards without invoking $predicate.

Parameters
$predicate : callable(T): bool
Return values
T>

sorted()

Sorts values, requires buffering all values.

public sorted([null|callable(T, T): int $compare = null ]) : R>
Parameters
$compare : null|callable(T, T): int = null
Tags
template
Return values
R>

take()

Take only the first N items of the pipeline.

public take(int $count) : T>
Parameters
$count : int
Return values
T>

takeWhile()

Takes values on the pipeline until {@code $predicate} returns {@code false}.

public takeWhile(callable(T): bool $predicate) : T>
Parameters
$predicate : callable(T): bool
Return values
T>

tap()

Invokes the given function each time a value is streamed through the pipeline to perform side effects.

public tap(callable(T): void $tap) : T>
Parameters
$tap : callable(T): void
Return values
T>

toArray()

Collects all items into an array.

public toArray() : array<int, T>
Return values
array<int, T>

unordered()

public unordered() : self
Return values
self

mapToConcurrentIterators()

private static mapToConcurrentIterators(array<string|int, mixed> $iterables) : array<string|int, mixed>
Parameters
$iterables : array<string|int, mixed>
Tags
template
template
Return values
array<string|int, mixed>

        
On this page

Search results