Class UnfoldIterator
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.
Property Summary
- 
        $_innerIterator protectedTraversableA reference to the internal iterator this object is wrapping. 
- 
        $_unfolder protectedcallableA function that is passed each element in this iterator and must return an array or Traversable object. 
Method Summary
- 
          __construct() publicCreates the iterator that will generate child iterators from each of the elements it was constructed with. 
- 
          getChildren() publicReturns an iterator containing the items generated by transforming the current value with the callable function. 
- 
          hasChildren() publicReturns true as each of the elements in the array represent a list of items 
Method Detail
__construct() ¶ public
__construct(Traversable $items, callable $unfolder)Creates the iterator that will generate child iterators from each of the elements it was constructed with.
Parameters
- 
                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. 
getChildren() ¶ public
getChildren(): RecursiveIteratorReturns an iterator containing the items generated by transforming the current value with the callable function.
Returns
RecursiveIteratorhasChildren() ¶ public
hasChildren(): boolReturns true as each of the elements in the array represent a list of items
Returns
bool