position = 0; $this->container = $container; } /** * Reset the status of the iterator * * @return void */ public function rewind() { $this->position = 0; } /** * Return the element at the current position. * * @return object The element at the current position. */ public function current() { return $this->container[$this->position]; } /** * Return the current position. * * @return integer The current position. */ public function key() { return $this->position; } /** * Move to the next position. * * @return void */ public function next() { ++$this->position; } /** * Check whether there are more elements to iterate. * * @return bool True if there are more elements to iterate. */ public function valid() { return isset($this->container[$this->position]); } }