You are here

public function SpreadsheetIterator::getHeaderRow in Migrate Spreadsheet 8

Same name and namespace in other branches
  1. 2.0.x src/SpreadsheetIterator.php \Drupal\migrate_spreadsheet\SpreadsheetIterator::getHeaderRow()

Gets the header row index.

Return value

int The header row index.

Overrides SpreadsheetIteratorInterface::getHeaderRow

1 call to SpreadsheetIterator::getHeaderRow()
SpreadsheetIterator::getHeaders in src/SpreadsheetIterator.php
Retrieves a full list of headers.

File

src/SpreadsheetIterator.php, line 223

Class

SpreadsheetIterator
Provides a spreadsheet iterator.

Namespace

Drupal\migrate_spreadsheet

Code

public function getHeaderRow() {
  if (!isset($this->cache['header_row'])) {
    $header_row = isset($this->configuration['header_row']) ? $this->configuration['header_row'] : NULL;
    if ($header_row !== NULL && (!is_numeric($this->configuration['header_row']) || $this->configuration['header_row'] < 1)) {
      throw new \InvalidArgumentException("Wrong header_row value '{$this->configuration['header_row']}'.");
    }
    $this->cache['header_row'] = $header_row;
  }
  return $this->cache['header_row'];
}