I have a class that is supposed to read XLSX files, but the file to be processed can also be an a ZIP file that contains XLSX files.
I have the following design:
FileReader: An interface for reading xlsx Worksheet files.
interface FileReader {
// returns array of worksheet rows
public function readSheet(string file, string sheetName): array
}
XlsxFileReader implements file reader uses PHPSpreadsheet package to read and return worksheet rows.
FileProcessor: This handles the processing of file(s) using XlxsFileReader, DataMapper to map each Worksheet row in to expected structure and format.
This suffice for reading .xlsx file and processing it.
My issue now is that i have a requirement to also process zip files that contain xlsx files.
Should my zip file processor extend FileProcessor? And in this case extract files then pass the files to File Processor?
Aucun commentaire:
Enregistrer un commentaire