/home/techb158/ileadtechnology.com/SSM/vendor/maatwebsite/excel/src
Edit: /home/techb158/ileadtechnology.com/SSM/vendor/maatwebsite/excel/src/ChunkReader.php (2730B)
registerEvents()[BeforeImport::class])) {
$reader->beforeImport($import);
}
$chunkSize = $import->chunkSize();
$totalRows = $reader->getTotalRows();
$worksheets = $reader->getWorksheets($import);
if ($import instanceof WithProgressBar) {
$import->getConsoleOutput()->progressStart(array_sum($totalRows));
}
$jobs = new Collection();
foreach ($worksheets as $name => $sheetImport) {
$startRow = HeadingRowExtractor::determineStartRow($sheetImport);
$totalRows[$name] = $sheetImport instanceof WithLimit ? $sheetImport->limit() : $totalRows[$name];
for ($currentRow = $startRow; $currentRow <= $totalRows[$name]; $currentRow += $chunkSize) {
$jobs->push(new ReadChunk(
$import,
$reader->getPhpSpreadsheetReader(),
$temporaryFile,
$name,
$sheetImport,
$currentRow,
$chunkSize
));
}
}
$jobs->push(new AfterImportJob($import, $reader));
if ($import instanceof ShouldQueue) {
return QueueImport::withChain($jobs->toArray())->dispatch($import);
}
$jobs->each(function ($job) {
try {
dispatch_now($job);
} catch (Throwable $e) {
if (method_exists($job, 'failed')) {
$job->failed($e);
}
throw $e;
}
});
if ($import instanceof WithProgressBar) {
$import->getConsoleOutput()->progressFinish();
}
unset($jobs);
return null;
}
}