\Cake\Collection\IteratorUnfoldIterator

An iterator that can be used to generate nested iterators out of a collection of items by applying an function to each of the elements in this iterator.

Summary

Methods
Properties
Constants
__construct()
hasChildren()
getChildren()
No public properties found
No constants found
No protected methods found
$_unfolder
$_innerIterator
N/A
No private methods found
No private properties found
N/A

Properties

$_unfolder

$_unfolder : callable

A function that is passed each element in this iterator and must return an array or Traversable object.

Type

callable

$_innerIterator

$_innerIterator : \Iterator

A reference to the internal iterator this object is wrapping.

Type

\Iterator

Methods

__construct()

__construct(array|\Traversable  $items, callable  $unfolder) 

Creates the iterator that will generate child iterators from each of the elements it was constructed with.

Parameters

array|\Traversable $items

The list of values to iterate

callable $unfolder

A callable function that will receive the current item and key. It must return an array or Traversable object out of which the nested iterators will be yielded.

hasChildren()

hasChildren() : boolean

Returns true as each of the elements in the array represent a list of items

Returns

boolean

getChildren()

getChildren() : \RecursiveIterator

Returns an iterator containing the items generated by transforming the current value with the callable function.

Returns

\RecursiveIterator