RecursiveCachingIterator
class RecursiveCachingIterator extends CachingIterator implements RecursiveIterator (View source)
...
Constants
CALL_TOSTRING |
String conversion flag (mutually exclusive): Uses the current element for the iterator's string conversion. This converts the current element to a string only once, regardless of whether it is needed or not. |
TOSTRING_USE_KEY |
String conversion flag (mutually exclusive). Uses the current key for the iterator's string conversion. |
TOSTRING_USE_CURRENT |
String conversion flag (mutually exclusive). Uses the current element for the iterator's string conversion. This converts the current element to a string only when (and every time) it is needed. |
TOSTRING_USE_INNER |
String conversion flag (mutually exclusive). Forwards the string conversion to the inner iterator. This converts the inner iterator to a string only once, regardless of whether it is needed or not. |
CATCH_GET_CHILD |
Ignore exceptions thrown in accessing children. Only used with {RecursiveCachingIterator}. |
FULL_CACHE |
Cache all read data. This is needed to use {CachingIterator and ArrayAccess and Countable methods. |
Methods
Constructs a new RecursiveCachingIterator.
Return the string representation of the current iteration based on the flag being used.
Set an element on the internal cache array.
Return whether an element at the index exists on the internal cache array.
Check whether the current element of the inner iterator has children
Return the inner iterator's children as a RecursiveCachingIterator
Details
__construct(Traversable $iterator, int $flags = CachingIterator::CALL_TOSTRING)
Constructs a new RecursiveCachingIterator.
Iterator|null
getInnerIterator()
Returns the inner iterator
void
rewind()
Rewind the iterator
bool
valid()
Check whether the current element is valid
mixed
key()
Return the key for the current element
mixed
current()
Return the current element
void
next()
Move the iterator forward
bool
hasNext()
Check whether the inner iterator has a valid next element
string
__toString()
Return the string representation of the current iteration based on the flag being used.
int
getFlags()
Get flags used
void
setFlags(int $flags)
The setFlags purpose
mixed
offsetGet(string $key)
Internal cache array index to retrieve.
void
offsetSet(string $key, TValue $value)
Set an element on the internal cache array.
void
offsetUnset(string $key)
Remove an element from the internal cache array.
bool
offsetExists(string $key)
Return whether an element at the index exists on the internal cache array.
array
getCache()
Retrieve the contents of the cache
int
count()
The number of elements in the iterator
bool
hasChildren()
Check whether the current element of the inner iterator has children
RecursiveIterator|null
getChildren()
Return the inner iterator's children as a RecursiveCachingIterator