Наследование: extends Box\Spout\Reader\Common\ReaderOptions
Пример #1
0
 /**
  * @param string $filePath Path of the XLSX file being read
  * @param string $sheetDataXMLFilePath Path of the sheet data XML file as in [Content_Types].xml
  * @param \Box\Spout\Reader\XLSX\ReaderOptions $options Reader's current options
  * @param Helper\SharedStringsHelper $sharedStringsHelper Helper to work with shared strings
  */
 public function __construct($filePath, $sheetDataXMLFilePath, $options, $sharedStringsHelper)
 {
     $this->filePath = $filePath;
     $this->sheetDataXMLFilePath = $this->normalizeSheetDataXMLFilePath($sheetDataXMLFilePath);
     $this->xmlReader = new XMLReader();
     $this->styleHelper = new StyleHelper($filePath);
     $this->cellValueFormatter = new CellValueFormatter($sharedStringsHelper, $this->styleHelper, $options->shouldFormatDates());
     $this->shouldPreserveEmptyRows = $options->shouldPreserveEmptyRows();
     // Register all callbacks to process different nodes when reading the XML file
     $this->xmlProcessor = new XMLProcessor($this->xmlReader);
     $this->xmlProcessor->registerCallback(self::XML_NODE_DIMENSION, XMLProcessor::NODE_TYPE_START, [$this, 'processDimensionStartingNode']);
     $this->xmlProcessor->registerCallback(self::XML_NODE_ROW, XMLProcessor::NODE_TYPE_START, [$this, 'processRowStartingNode']);
     $this->xmlProcessor->registerCallback(self::XML_NODE_CELL, XMLProcessor::NODE_TYPE_START, [$this, 'processCellStartingNode']);
     $this->xmlProcessor->registerCallback(self::XML_NODE_ROW, XMLProcessor::NODE_TYPE_END, [$this, 'processRowEndingNode']);
     $this->xmlProcessor->registerCallback(self::XML_NODE_WORKSHEET, XMLProcessor::NODE_TYPE_END, [$this, 'processWorksheetEndingNode']);
 }