|
34 | 34 | *
|
35 | 35 | * @author David de Boer <[email protected]>
|
36 | 36 | *
|
37 |
| - * @see http://phpexcel.codeplex.com/ |
38 |
| - * @see https://github.com/logiQ/PHPSpreadsheet |
| 37 | + * @see https://github.com/PHPOffice/PhpSpreadsheet |
39 | 38 | */
|
40 | 39 | class SpreadsheetReader implements CountableReader, \SeekableIterator
|
41 | 40 | {
|
@@ -71,29 +70,29 @@ class SpreadsheetReader implements CountableReader, \SeekableIterator
|
71 | 70 | * @param \SplFileObject $file Spreadsheet file
|
72 | 71 | * @param int $headerRowNumber Optional number of header row
|
73 | 72 | * @param int $activeSheet Index of active sheet to read from
|
74 |
| - * @param bool $readOnly If set to false, the reader take care of the excel formatting (slow) |
| 73 | + * @param bool $readOnly If set to false, the reader take care of the spreadsheet formatting (slow) |
75 | 74 | * @param int $maxRows Maximum number of rows to read
|
76 | 75 | */
|
77 | 76 | public function __construct(\SplFileObject $file, $headerRowNumber = null, $activeSheet = null, $readOnly = true, $maxRows = null)
|
78 | 77 | {
|
79 | 78 | // phpcs:enable Generic.Files.LineLength.MaxExceeded
|
80 | 79 | $reader = IOFactory::createReaderForFile($file->getPathName());
|
81 | 80 | $reader->setReadDataOnly($readOnly);
|
82 |
| - /** @var Spreadsheet $excel */ |
83 |
| - $excel = $reader->load($file->getPathname()); |
| 81 | + /** @var Spreadsheet $spreadsheet */ |
| 82 | + $spreadsheet = $reader->load($file->getPathname()); |
84 | 83 |
|
85 | 84 | if (null !== $activeSheet) {
|
86 |
| - $excel->setActiveSheetIndex($activeSheet); |
| 85 | + $spreadsheet->setActiveSheetIndex($activeSheet); |
87 | 86 | }
|
88 | 87 |
|
89 | 88 | /** @var Worksheet $sheet */
|
90 |
| - $sheet = $excel->getActiveSheet(); |
| 89 | + $sheet = $spreadsheet->getActiveSheet(); |
91 | 90 |
|
92 | 91 | if ($maxRows && $maxRows < $sheet->getHighestDataRow()) {
|
93 | 92 | $maxColumn = $sheet->getHighestDataColumn();
|
94 | 93 | $this->worksheet = $sheet->rangeToArray('A1:'.$maxColumn.$maxRows);
|
95 | 94 | } else {
|
96 |
| - $this->worksheet = $excel->getActiveSheet()->toArray(); |
| 95 | + $this->worksheet = $spreadsheet->getActiveSheet()->toArray(); |
97 | 96 | }
|
98 | 97 |
|
99 | 98 | if (null !== $headerRowNumber) {
|
@@ -127,7 +126,7 @@ public function current()
|
127 | 126 | {
|
128 | 127 | $row = $this->worksheet[$this->pointer];
|
129 | 128 |
|
130 |
| - // If the excel file has column headers, use them to construct an associative |
| 129 | + // If the spreadsheet file has column headers, use them to construct an associative |
131 | 130 | // array for the columns in this line
|
132 | 131 | if (count($this->columnHeaders) === count($row)) {
|
133 | 132 | return array_combine(array_values($this->columnHeaders), $row);
|
|
0 commit comments