/** * Restarts the iterator * * @return NULL */ public function rewind() { if (!isset($this->offset)) { return NULL; } $this->inner->rewind(); if ($this->offset == 0) { return NULL; } // If they gave us a seekable iterator, make use of it if ($this->inner instanceof \SeekableIterator) { try { $this->inner->seek($this->offset); } catch (\OutOfBoundsException $err) { } } else { for ($i = 0; $i < $this->offset && $this->valid(); $i++) { $this->next(); } } }