PHP Class phpstreams\Collectors

For compatibility reasons, the returned collectors are actuall classes, rather than anonymous classes. This is an implementation detail, and should not be relied upon. The implementing classes may be removed at any point.
Author: Bert Peters ([email protected])
Afficher le fichier Open project: bertptrs/phpstreams Class Usage Examples

Méthodes publiques

Méthode Description
averaging ( ) : phpstreams\Collector Collector that returns the average of the given elements.
joining ( string $delimiter = "" ) : phpstreams\Collector Get a collector that concatenates all the elements in the stream.
reducing ( mixed $identity, callable $reduction ) : phpstreams\Collector Get a collector that applies the given reduction to the stream.

Private Methods

Méthode Description
__construct ( ) Hidden constructor, static class.

Method Details

averaging() public static méthode

The return type of this collector is float, regardless of the type of the stream elements.
public static averaging ( ) : phpstreams\Collector
Résultat phpstreams\Collector

joining() public static méthode

Get a collector that concatenates all the elements in the stream.
public static joining ( string $delimiter = "" ) : phpstreams\Collector
$delimiter string [optional] A delimiter to insert between elements. Defaults to the empty string.
Résultat phpstreams\Collector

reducing() public static méthode

Get a collector that applies the given reduction to the stream.
public static reducing ( mixed $identity, callable $reduction ) : phpstreams\Collector
$identity mixed
$reduction callable
Résultat phpstreams\Collector