public function handleFile(ReaderInterface $reader, $path) { $reader->open($path); $output = []; while ($reader->hasNextRow()) { $output[] = $reader->nextRow(); } $reader->close(); return $output; }
/** * Close reader and remove folder created when archive has been extracted */ public function __destruct() { if (null !== $this->reader) { $this->reader->close(); } if (null !== $this->archivePath) { $fileSystem = new Filesystem(); $fileSystem->remove($this->archivePath); $this->archivePath = null; } }