iterator = $iterator; } public function rewind() { $this->iterator->rewind(); $this->key = 0; } public function next() { $this->iterator->next(); ++$this->key; } public function valid() { return $this->iterator->valid(); } public function current() { return $this->iterator->current(); } public function key() { return $this->key; } }