createRowIterator() public method

Returns a row iterator for the current worksheet index
public createRowIterator ( integer $worksheetIndex, array $options = [] ) : Iterator
$worksheetIndex integer
$options array
return Iterator
Esempio n. 1
0
 /**
  * Get the heading.
  *
  * @param SpreadsheetInterface $workbook
  * @param                      $sheetIndex
  *
  * @return array
  */
 protected function getHeading(SpreadsheetInterface $workbook, $sheetIndex)
 {
     // Fetch the first row
     $row = $workbook->createRowIterator($sheetIndex, $this->settings->getRowIteratorSettings());
     // Set empty labels array
     $heading = [];
     // Loop through the cells
     foreach ($row as $index => $values) {
         if ($index == $this->settings->getHeadingRow()) {
             foreach ($values as $cell) {
                 $heading[] = $this->getIndex($cell);
             }
             return $heading;
         }
     }
     return $heading;
 }