diff options
author | Silvio <silvio@devlet.com.br> | 2010-07-07 17:05:39 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-07-07 17:05:39 -0300 |
commit | 474a3e1b190e2e3dbc5806350f37d28001c9b222 (patch) | |
tree | e00660127756119baeaee24406507d4484519b41 | |
parent | 4263906bee5e85ad067f9f752c5698ccdcc13d67 (diff) | |
download | cinisis-474a3e1b190e2e3dbc5806350f37d28001c9b222.tar.gz cinisis-474a3e1b190e2e3dbc5806350f37d28001c9b222.tar.bz2 |
Fixing null checking at IsisFieldIterator
-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(); } } |