_file = $file; $this->_chunk_size = $chunk_size; } /** * @return void */ public function rewind():void { $this->_file->seek(0); } /** * @return bool */ public function hasNext():bool { return $this->_file->tell() < $this->_file->getSize(); } /** * @return FileChunk|null * @throws IOException */ public function next():?FileChunk { if(!$this->hasNext()) return null; $chunk = new FileChunk($this->_file, $this->_chunk_size); if(!$chunk->getSize()) return null; return $chunk; } }