public function seek($position) { $this->rewind(); $current = 0; while ($current < $position) { if (!$this->valid()) { throw new Exception\OutOfBoundsException('Invalid seek position'); } $this->next(); $current++; } }