\Phug\UtilCollection

Summary

Methods
Properties
Constants
__construct()
isIterable()
makeIterable()
getIterator()
getIterable()
getGenerator()
map()
flatMap()
yieldMap()
yieldFlatMap()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$traversable
N/A

Properties

$traversable

$traversable : \Phug\Util\iterable

Type

\Phug\Util\iterable

Methods

__construct()

__construct(  $value) 

Parameters

$value

isIterable()

isIterable(mixed  $value) : boolean

Polyfill of is_iterable.

Parameters

mixed $value

Returns

boolean

makeIterable()

makeIterable(mixed  $value) : \Phug\Util\iterable

Wrap given value in an array if it's not yet iterable.

Parameters

mixed $value

Returns

\Phug\Util\iterable

getIterator()

getIterator() : \Traversable

Retrieve an external iterator.

Returns

\Traversable —

An instance of an object implementing Iterator or Traversable

getIterable()

getIterable() : \Phug\Util\iterable

Get input data as iterable value.

Returns

\Phug\Util\iterable

getGenerator()

getGenerator() : \Generator

Get input data as a generator of values.

Returns

\Generator

map()

map(callable  $callback) : static

Return the result of the passed function for each item of the collection.

Parameters

callable $callback

Returns

static

flatMap()

flatMap(callable  $callback) : static

Return the result of the passed function for each item of the collection.

If item is a generator (using yield from inside the function), then it will flatten the yielded values for one more level.

Parameters

callable $callback

Returns

static

yieldMap()

yieldMap(callable  $callback) : \Generator

Return the result of the passed function for each item of the collection.

Parameters

callable $callback

Returns

\Generator

yieldFlatMap()

yieldFlatMap(callable  $callback) : \Generator

Return the result of the passed function for each item of the collection.

If item is a generator (using yield from inside the function), then it will flatten the yielded values for one more level.

Parameters

callable $callback

Returns

\Generator