RecursiveIteratorIterator
class RecursiveIteratorIterator implements OuterIterator (View source)
Can be used to iterate through recursive iterators.
Constants
LEAVES_ONLY |
The default. Lists only leaves in iteration. |
SELF_FIRST |
Lists leaves and parents in iteration with parents coming first. |
CHILD_FIRST |
Lists leaves and parents in iteration with leaves coming first. |
CATCH_GET_CHILD |
Special flag: Ignore exceptions thrown in accessing children. |
Methods
Construct a RecursiveIteratorIterator
Rewind the iterator to the first element of the top level inner iterator
Check whether the current position is valid
Access the current key
Access the current element value
Move forward to the next element
Get the current depth of the recursive iteration
The current active sub iterator
Get inner iterator
Begin Iteration
End Iteration
Has children
Get children
Begin children
End children
Next element
Set max depth
Get max depth
Details
__construct(Traversable $iterator, int $mode = self::LEAVES_ONLY, int $flags = 0)
Construct a RecursiveIteratorIterator
void
rewind()
Rewind the iterator to the first element of the top level inner iterator
bool
valid()
Check whether the current position is valid
mixed
key()
Access the current key
mixed
current()
Access the current element value
void
next()
Move forward to the next element
int
getDepth()
Get the current depth of the recursive iteration
RecursiveIterator|null
getSubIterator(int $level)
The current active sub iterator
Iterator|null
getInnerIterator()
Get inner iterator
void
beginIteration()
Begin Iteration
void
endIteration()
End Iteration
bool
callHasChildren()
Has children
RecursiveIterator|null
callGetChildren()
Get children
void
beginChildren()
Begin children
void
endChildren()
End children
void
nextElement()
Next element
void
setMaxDepth(int $maxDepth = -1)
Set max depth
int|false
getMaxDepth()
Get max depth