chunkSize = $chunkSize; } public function rewind() { $this->next(); } public function next() { $this->chunk = array(); $inner = $this->getInnerIterator(); for ($i = 0; $i < $this->chunkSize && $inner->valid(); $i++) { $this->chunk[] = $inner->current(); $inner->next(); } } public function current() { return $this->chunk; } public function valid() { return !empty($this->chunk); } }