49 if ((($flags & self::CALL_TOSTRING) && ($flags & (self::TOSTRING_USE_KEY|self::TOSTRING_USE_CURRENT)))
50 || ((flags & (self::CIT_TOSTRING_USE_KEY|self::CIT_TOSTRING_USE_CURRENT)) == (self::CIT_TOSTRING_USE_KEY|self::CIT_TOSTRING_USE_CURRENT)))
52 throw new InvalidArgumentException(
'Flags must contain only one of CIT_CALL_TOSTRING, CIT_TOSTRING_USE_KEY, CIT_TOSTRING_USE_CURRENT');
55 $this->flags = $flags & (0x0000FFFF);
71 if ($this->
valid = $this->it->valid()) {
72 $this->
current = $this->it->current();
73 $this->
key = $this->it->key();
74 if ($this->flags & self::CALL_TOSTRING) {
75 if (is_object($this->
current)) {
76 $this->strValue = $this->
current->__toString();
78 $this->strValue = (string)$this->
current;
84 $this->strValue = NULL;
100 return $this->it->valid();
124 return call_user_func_array(array($this->it, $func), $params);
133 if ($this->flags & self::TOSTRING_USE_KEY)
137 else if ($this->flags & self::TOSTRING_USE_CURRENT)
141 if (!$this->flags & self::CALL_TOSTRING)
143 throw new exception(
'CachingIterator does not fetch string value (see CachingIterator::__construct)');
const TOSTRING_USE_CURRENT
__call($func, $params)
Aggregate the inner iterator.
Interface to access the current inner iteraor of iterator wrappers.
Cached iteration over another Iterator.
next()
Forward to the next element.
__construct(Iterator $it, $flags=self::CALL_TOSTRING)
Construct from another iterator.
Exception that denotes invalid arguments were passed.
rewind()
Rewind the Iterator.