arr = $array; $this->flags = $flags; reset($this->arr); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.append.php ) * * Appends value as the last element. WarningThis function is currently * not documented; only its argument list is available. * * @value mixed The value to append. * * @return mixed No value is returned. */ public function append($value) { $this->arr[] = $value; } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.asort.php ) * * Sorts an array by values. WarningThis function is currently not * documented; only its argument list is available. * * @return mixed No value is returned. */ public function asort() { return asort($this->arr, $this->flags); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.count.php ) * * Gets the number of elements in the array, or the number of public * properties in the object. WarningThis function is currently not * documented; only its argument list is available. * * @return mixed The number. */ public function count() { return count($this->arr); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.current.php ) * * Get the current array entry. * * @return mixed The current array entry. */ public function current() { return current($this->arr); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.getarraycopy.php ) * * Get a copy of an array. WarningThis function is currently not * documented; only its argument list is available. * * @return mixed A copy of the array, or array of public properties * if ArrayIterator refers to an object. */ public function getArrayCopy() { return $this->arr; } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.getflags.php ) * * Get the current flags. WarningThis function is currently not * documented; only its argument list is available. * * @return mixed The current flags. */ public function getFlags() { return $this->flags; } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.key.php ) * * This function returns the current array key * * @return mixed The current array key. */ public function key() { return key($this->arr); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.ksort.php ) * * Sorts an array by the keys. WarningThis function is currently not * documented; only its argument list is available. * * @return mixed No value is returned. */ public function ksort() { return ksort($this->arr, $this->flags); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.natcasesort.php ) * * Sort the entries by values using a case insensitive "natural order" * algorithm. WarningThis function is currently not documented; only its * argument list is available. * * @return mixed No value is returned. */ public function natcasesort() { return natcasesort($this->arr); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.natsort.php ) * * Sort the entries by values using "natural order" algorithm. WarningThis * function is currently not documented; only its argument list is * available. * * @return mixed No value is returned. */ public function natsort() { return natsort($this->arr); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.next.php ) * * The iterator to the next entry. * * @return mixed No value is returned. */ public function next() { next($this->arr); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.offsetexists.php ) * * Checks if the offset exists. WarningThis function is currently not * documented; only its argument list is available. * * @index mixed The offset being checked. * * @return mixed TRUE if the offset exists, otherwise FALSE */ public function offsetExists($index) { return isset($this->arr[$index]); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.offsetget.php ) * * Gets the value from the provided offset. WarningThis function is * currently not documented; only its argument list is available. * * @index mixed The offset to get the value from. * * @return mixed The value at offset index. */ public function offsetGet($index) { return $this->arr[$index]; } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.offsetset.php ) * * Sets a value for a given offset. WarningThis function is currently not * documented; only its argument list is available. * * @index mixed The index to set for. * @newval mixed The new value to store at the index. * * @return mixed No value is returned. */ public function offsetSet($index, $newval) { $this->arr[$index] = $newval; } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.offsetunset.php ) * * Unsets a value for an offset. WarningThis function is currently not * documented; only its argument list is available. * * @index mixed The offset to unset. * * @return mixed No value is returned. */ public function offsetUnset($index) { unset($this->arr[$index]); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.rewind.php ) * * This rewinds the iterator to the beginning. * * @return mixed No value is returned. */ public function rewind() { reset($this->arr); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.seek.php ) * * * @position mixed The position to seek to. * * @return mixed No value is returned. */ public function seek($position) { reset($this->arr); for ($i = 0; $i < $position; $i++) { if (!next($this->arr)) { break; } } } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.setflags.php ) * * Sets behaviour flags. WarningThis function is currently not documented; * only its argument list is available. * * @flags mixed A bitmask as follows: 0 = Properties of the object * have their normal functionality when accessed as * list (var_dump, foreach, etc.). 1 = Array indices * can be accessed as properties in read/write. * * @return mixed No value is returned. */ public function setFlags($flags) { $this->flags = $flags; } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.uasort.php ) * * Sort the entries by values using user defined function. WarningThis * function is currently not documented; only its argument list is * available. * * @cmp_function * mixed The compare function used for the sort. * * @return mixed No value is returned. */ public function uasort($cmp_function) { return uasort($this->arr, $cmp_function); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.uksort.php ) * * Sort the entries by key using user defined function. WarningThis * function is currently not documented; only its argument list is * available. * * @cmp_function * mixed The compare function used for the sort. * * @return mixed No value is returned. */ public function uksort($cmp_function) { return uksort($this->arr, $cmp_function); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/arrayiterator.valid.php ) * * Checks if the array contains any more entries. * * @return mixed No value is returned. */ public function valid() { return key($this->arr) !== null; } } // http://www.php.net/~helly/php/ext/spl/iteratoriterator_8inc-source.html class IteratorIterator implements OuterIterator { private $iterator; public function __construct(Traversable $iterator) { if ($iterator instanceof IteratorAggregate) { $iterator = $iterator->getIterator(); } if ($iterator instanceof Iterator) { $this->iterator = $iterator; } else { throw new Exception( "Need to pass a Traversable that is convertable to an iterator"); } } public function getInnerIterator() { return $this->iterator; } public function valid() { return $this->iterator->valid(); } public function key() { return $this->iterator->key(); } public function current() { return $this->iterator->current(); } public function next() { return $this->iterator->next(); } public function rewind() { return $this->iterator->rewind(); } public function __call($func, $params) { return call_user_func_array(array($this->iterator, $func), $params); } } // http://www.php.net/~helly/php/ext/spl/filteriterator_8inc-source.html // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/class.filteriterator.php ) * * This abstract iterator filters out unwanted values. This class should * be extended to implement custom iterator filters. The * FilterIterator::accept() must be implemented in the subclass. * */ abstract class FilterIterator extends IteratorIterator { private $it; public function __construct(Iterator $it) { $this->it = $it; } public function rewind() { $this->it->rewind(); $this->fetch(); } abstract function accept(); private function fetch() { while ($this->it->valid()) { if ($this->accept()) { return; } $this->it->next(); } } public function next() { $this->it->next(); $this->fetch(); } public function valid() { return $this->it->valid(); } public function key() { return $this->it->key(); } public function current() { return $this->it->current(); } protected function __clone() { // disallow clone } public function getInnerIterator() { return $this->it; } public function __call($func, $params) { return call_user_func_array(array($this->it, $func), $params); } } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/class.iteratoraggregate.php ) * * Interface to create an external Iterator. * */ interface IteratorAggregate extends Traversable { // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from * http://php.net/manual/en/iteratoraggregate.getiterator.php ) * * Returns an external iterator. * * @return mixed An instance of an object implementing Iterator or * Traversable */ public function getIterator(); } interface Iterable extends IteratorAggregate { } interface KeyedIterable extends Iterable { } /////////////////////////////////////////////////////////////////////////////// // http://www.php.net/~helly/php/ext/spl/appenditerator_8inc-source.html // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/class.appenditerator.php ) * * An Iterator that iterates over several iterators one after the other. * */ class AppendIterator implements OuterIterator { private $iterators; function __construct() { $this->iterators = new ArrayIterator(array()); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/appenditerator.append.php ) * * Appends an iterator. WarningThis function is currently not documented; * only its argument list is available. * * @it mixed The iterator to append. * * @return mixed No value is returned. */ function append(Iterator $it) { $this->iterators->append($it); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from * http://php.net/manual/en/appenditerator.getinneriterator.php ) * * Get an inner iterator WarningThis function is currently not documented; * only its argument list is available. * * @return mixed The current inner Iterator. */ function getInnerIterator() { return $this->iterators->current(); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/appenditerator.rewind.php ) * * Rewind to the first element of the first inner Iterator. WarningThis * function is currently not documented; only its argument list is * available. * * @return mixed No value is returned. */ function rewind() { $this->iterators->rewind(); if ($this->iterators->valid()) { $this->getInnerIterator()->rewind(); } } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/appenditerator.valid.php ) * * Checks validity of the current element. WarningThis function is * currently not documented; only its argument list is available. * * @return mixed Returns TRUE on success or FALSE on failure. */ function valid() { return $this->iterators->valid() && $this->getInnerIterator()->valid(); } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/appenditerator.current.php ) * * Gets the current value. WarningThis function is currently not * documented; only its argument list is available. * * @return mixed The current value if it is valid or NULL otherwise. */ function current() { /* Using $this->valid() would be exactly the same; it would omit * the access to a non valid element in the inner iterator. Since * the user didn't respect the valid() return value false this * must be intended hence we go on. */ return $this->iterators->valid() ? $this->getInnerIterator()->current() : NULL; } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/appenditerator.key.php ) * * Get the current key WarningThis function is currently not documented; * only its argument list is available. * * @return mixed The current key if it is valid or NULL otherwise. */ function key() { return $this->iterators->valid() ? $this->getInnerIterator()->key() : NULL; } // Do NOT modifiy this doc comment block generated by idl/sysdoc.php /** * ( excerpt from http://php.net/manual/en/appenditerator.next.php ) * * Moves to the next element. If this means to another Iterator then it * rewinds that Iterator. WarningThis function is currently not documented; * only its argument list is available. * * @return mixed No value is returned. */ function next() { if (!$this->iterators->valid()){ return; /* done all */ } $this->getInnerIterator()->next(); if ($this->getInnerIterator()->valid()) { return; /* found valid element in current inner iterator */ } $this->iterators->next(); while ($this->iterators->valid()) { $this->getInnerIterator()->rewind(); if ($this->getInnerIterator()->valid()) { return; /* found element as first elemet in another iterator */ } $this->iterators->next(); } } function __call($func, $params) { return call_user_func_array(array($this->getInnerIterator(), $func), $params); } }