Iterator for flattening elements in a tree structure while adding some visual markers for their relative position in the tree
CATCH_GET_CHILD
, CHILD_FIRST
, LEAVES_ONLY
, SELF_FIRST
$_current
protected mixed
$_key
protected callable
$_spacer
protected string
$_value
protected callable
__construct( RecursiveIterator $items , string|callable $valuePath , string|callable $keyPath , string $spacer , integer $mode Cake\Collection\Iterator\RecursiveIteratorIterator::SELF_FIRST )
Constructor
$items
$valuePath
The property to extract or a callable to return the display value.
$keyPath
The property to use as iteration key or a callable returning the key value.
$spacer
The string to use for prefixing the values according to their depth in the tree.
$mode
optional Cake\Collection\Iterator\RecursiveIteratorIterator::SELF_FIRST RecursiveIteratorIterator::__construct()
_fetchCurrent( )
Returns the current iteration element and caches its value
current( )
Returns the current iteration value
RecursiveIteratorIterator::current()
key( )
Returns the current iteration key
RecursiveIteratorIterator::key()
next( )
Advances the cursor one position
RecursiveIteratorIterator::next()
_unwrap( )
append( $items )
cartesianProduct( callable $operation null , callable $filter null )
Cake\Collection\CollectionInterface
chunk( $chunkSize )
chunkWithKeys( $chunkSize , $preserveKeys true )
combine( $keyPath , $valuePath , $groupPath null )
compile( $preserveKeys true )
contains( $value )
countBy( $callback )
each( callable $c )
every( callable $c )
extract( $matcher )
first( )
firstMatch( array $conditions )
groupBy( $callback )
indexBy( $callback )
isEmpty( )
jsonSerialize( )
last( )
listNested( $dir 'desc' , $nestingKey 'children' )
Cake\Collection\Iterator\TreeIterator
match( array $conditions )
max( $callback , $type SORT_NUMERIC )
min( $callback , $type SORT_NUMERIC )
nest( $idPath , $parentPath , $nestingKey 'children' )
reduce( callable $c , $zero null )
sample( $size 10 )
shuffle( )
skip( $howMany )
some( callable $c )
sortBy( $callback , $dir SORT_DESC , $type SORT_NUMERIC )
sumOf( $matcher null )
take( $size 1 , $from 0 )
through( callable $handler )
toArray( $preserveKeys true )
toList( )
unfold( callable $transformer null )
unwrap( )
zip( $items )
zipWith( $items , $callable )
protected string
The string to use for prefixing the values according to their depth in the tree.
© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.4/class-Cake.Collection.Iterator.TreePrinter.html