diff options
Diffstat (limited to 'classes/IsisFieldIterator.php')
-rw-r--r-- | classes/IsisFieldIterator.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/classes/IsisFieldIterator.php b/classes/IsisFieldIterator.php index fb67b65..11ed979 100644 --- a/classes/IsisFieldIterator.php +++ b/classes/IsisFieldIterator.php @@ -53,13 +53,27 @@ class IsisFieldIterator implements Iterator do { ++$this->row; } - while ($this->current() == NULL && $this->valid()); + while ($this->current_null() && $this->has_more_rows()); + } + + /** + * Check if there are more rows. + */ + function has_more_rows() { + return $this->row <= $this->rows; + } + + /** + * Check if the current value is null. + */ + function current_null() { + return $this->current() == NULL; } /** * Check if there is a current element after calls to rewind() or next(). */ function valid() { - return $this->row <= $this->rows; + return $this->has_more_rows() && !$this->current_null(); } } |