/** * @param array $row * * @return CellCollection */ public function parse(array $row = []) { $cells = []; foreach ($row as $index => $cell) { $index = $this->settings->getHasHeading() && isset($this->heading[$index]) ? $this->heading[$index] : $index; $cells[$index] = $cell; } return new CellCollection($cells); }
/** * @param PHPExcel_Worksheet_Row $row * * @return CellCollection */ public function parse(PHPExcel_Worksheet_Row $row) { $iterator = $row->getCellIterator(); $iterator->setIterateOnlyExistingCells($this->settings->getIgnoreEmpty()); $cells = []; foreach ($iterator as $index => $cell) { $index = $this->settings->getHasHeading() && isset($this->heading[$index]) ? $this->heading[$index] : $this->getIndexFromColumn($cell); $cells[$index] = new Cell($cell, $index, $this->settings); } return new CellCollection($cells); }
/** * Get the start row. * * @return mixed */ protected function getStartRow() { $startRow = $this->settings->getStartRow(); // If the reader has a heading, skip the first row if ($this->settings->getHasHeading()) { $startRow = $this->settings->getHeadingRow(); $startRow++; } // Get the amount of rows to skip $skip = $this->settings->getSkipAmount(); // If we want to skip rows, add the amount of rows if ($skip > 0) { $startRow = $startRow + $skip; } return $startRow; }