From 4cfb71f1f5c302061a7188081a17f0366a2da963 Mon Sep 17 00:00:00 2001 From: Silvio Date: Thu, 19 Aug 2010 16:29:40 -0300 Subject: Adding IsisEntryIterator --- classes/iterators/IsisEntryIterator.php | 66 +++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 classes/iterators/IsisEntryIterator.php (limited to 'classes/iterators/IsisEntryIterator.php') diff --git a/classes/iterators/IsisEntryIterator.php b/classes/iterators/IsisEntryIterator.php new file mode 100644 index 0000000..6a1d72c --- /dev/null +++ b/classes/iterators/IsisEntryIterator.php @@ -0,0 +1,66 @@ +read($entry); + + // Setup. + $this->class = $class; + $this->entry = $this->start = $entry; + $this->entries = $class->entries; + } + + /** + * Rewind the Iterator to the first element. + */ + function rewind() { + $this->entry = $this->start; + } + + /** + * Return the key of the current element. + */ + function key() { + return $this->entry; + } + + /** + * Return the current element. + */ + function current() { + return $this->class->result; + } + + /** + * Move forward to next element. + */ + function next() { + $this->class->read(++$this->entry); + } + + /** + * Check if there is a current element after calls to rewind() or next(). + */ + function valid() { + return $this->entry <= $this->entries; + } +} -- cgit v1.2.3