You are here

public function SpreadsheetIterator::getWorksheet in Migrate Spreadsheet 2.0.x

Same name and namespace in other branches
  1. 8 src/SpreadsheetIterator.php \Drupal\migrate_spreadsheet\SpreadsheetIterator::getWorksheet()

Gets the worksheet.

Return value

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet The PHP Office worksheet object.

Throws

\InvalidArgumentException If an empty or invalid 'worksheet' has been passed.

Overrides SpreadsheetIteratorInterface::getWorksheet

File

src/SpreadsheetIterator.php, line 145

Class

SpreadsheetIterator
Provides a spreadsheet iterator.

Namespace

Drupal\migrate_spreadsheet

Code

public function getWorksheet() : Worksheet {
  if (!isset($this->cache['worksheet'])) {
    if (empty($this->configuration['worksheet']) || !$this->configuration['worksheet'] instanceof Worksheet) {
      throw new \InvalidArgumentException("No valid 'worksheet' configuration.");
    }
    $this->cache['worksheet'] = $this->configuration['worksheet'];
  }
  return $this->cache['worksheet'];
}