From c4dd7a1a684490673e25aaf4fabec5df138854c4 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Thu, 14 Mar 2013 05:42:27 +0000 Subject: Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2. --- ext/spl/internal/iteratoriterator.inc | 121 ++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 ext/spl/internal/iteratoriterator.inc (limited to 'ext/spl/internal/iteratoriterator.inc') diff --git a/ext/spl/internal/iteratoriterator.inc b/ext/spl/internal/iteratoriterator.inc new file mode 100644 index 0000000..37676e0 --- /dev/null +++ b/ext/spl/internal/iteratoriterator.inc @@ -0,0 +1,121 @@ +getIterator(); + } + if ($iterator instanceof Iterator) + { + $this->iterator = $iterator; + } + else + { + throw new Exception("Classes that only implement Traversable can be wrapped only after converting class IteratorIterator into c code"); + } + } + + /** \return the inner iterator as passed to the constructor + */ + function getInnerIterator() + { + return $this->iterator; + } + + /** \return whether the iterator is valid + */ + function valid() + { + return $this->iterator->valid(); + } + + /** \return current key + */ + function key() + { + return $this->iterator->key(); + } + + /** \return current value + */ + function current() + { + return $this->iterator->current(); + } + + /** forward to next element + */ + function next() + { + return $this->iterator->next(); + } + + /** rewind to the first element + */ + function rewind() + { + return $this->iterator->rewind(); + } + + /** Aggregate the inner iterator + * + * @param func Name of method to invoke + * @param params Array of parameters to pass to method + */ + function __call($func, $params) + { + return call_user_func_array(array($this->iterator, $func), $params); + } + + /** The inner iterator must be private because when this class will be + * converted to c code it won't no longer be available. + */ + private $iterator; +} + +?> -- cgit v1.2.1