From d95a67bf1bc97ff6eaf13e4c7d8da339b844e772 Mon Sep 17 00:00:00 2001 From: Silvio Date: Wed, 28 Jul 2010 17:27:59 -0300 Subject: Fixing initial condition for IsisMethodIterator --- classes/iterators/IsisMethodIterator.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'classes') diff --git a/classes/iterators/IsisMethodIterator.php b/classes/iterators/IsisMethodIterator.php index 4e5871c..4d2bbd4 100644 --- a/classes/iterators/IsisMethodIterator.php +++ b/classes/iterators/IsisMethodIterator.php @@ -8,6 +8,7 @@ class IsisMethodIterator implements Iterator private $total = 0; private $class; private $keys; + private $position = -1; /** * Constructor. @@ -16,16 +17,21 @@ class IsisMethodIterator implements Iterator * Instance of IsisConnector or child class. */ public function __construct($class) { + // Setup. $this->class = $class; $this->total = count($class->fields); $this->keys = array_keys($class->fields); + + // Find the first valid occurrence. + $this->next(); } /** - * Rewind the Iterator to the first element. + * Rewind the Iterator to the first valid element. */ function rewind() { - $this->position = 0; + $this->position = -1; + $this->next(); } /** -- cgit v1.2.3