RecursiveTreeIterator
class RecursiveTreeIterator extends RecursiveIteratorIterator (View source)
Allows iterating over a RecursiveIterator to generate an ASCII graphic tree.
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. |
BYPASS_CURRENT |
|
BYPASS_KEY |
|
PREFIX_LEFT |
|
PREFIX_MID_HAS_NEXT |
|
PREFIX_MID_LAST |
|
PREFIX_END_HAS_NEXT |
|
PREFIX_END_LAST |
|
PREFIX_RIGHT |
|
Methods
Construct a RecursiveTreeIterator
Rewind iterator
Check validity
Get the key of the current element
Get current element
Move to next element
The current active sub iterator
Begin iteration
End iteration
Has children
Get children
Begin children
End children
Next element
Get the prefix
No description
Set a part of the prefix
Get current entry
Get the postfix
Details
__construct(Traversable $iterator, int $flags = self::BYPASS_KEY, int $cachingIteratorFlags = CachingIterator::CATCH_GET_CHILD, int $mode = RecursiveIteratorIterator::SELF_FIRST)
Construct a RecursiveTreeIterator
void
rewind()
Rewind iterator
bool
valid()
Check validity
mixed
key()
Get the key of the current element
mixed
current()
Get current element
void
next()
Move to 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
string
getPrefix()
Get the prefix
void
setPostfix(string $postfix)
No description
void
setPrefixPart(int $part, string $value)
Set a part of the prefix
string
getEntry()
Get current entry
string
getPostfix()
Get the postfix