1 | <?php |
||
19 | class EntityFactory implements EntityFactoryInterface |
||
20 | { |
||
21 | /** @var HelperFactory */ |
||
22 | private $helperFactory; |
||
23 | |||
24 | /** @var ManagerFactory */ |
||
25 | private $managerFactory; |
||
26 | |||
27 | /** |
||
28 | * @param ManagerFactory $managerFactory |
||
29 | * @param HelperFactory $helperFactory |
||
30 | */ |
||
31 | 79 | public function __construct(ManagerFactory $managerFactory, HelperFactory $helperFactory) |
|
36 | |||
37 | /** |
||
38 | * @param string $filePath Path of the file to be read |
||
39 | * @param \Box\Spout\Common\Manager\OptionsManagerInterface $optionsManager Reader's options manager |
||
40 | * @param SharedStringsManager $sharedStringsManager Manages shared strings |
||
41 | * @return SheetIterator |
||
42 | */ |
||
43 | 35 | public function createSheetIterator($filePath, $optionsManager, $sharedStringsManager) |
|
49 | |||
50 | /** |
||
51 | * @param string $filePath Path of the XLSX file being read |
||
52 | * @param string $sheetDataXMLFilePath Path of the sheet data XML file as in [Content_Types].xml |
||
53 | * @param int $sheetIndex Index of the sheet, based on order in the workbook (zero-based) |
||
54 | * @param string $sheetName Name of the sheet |
||
55 | * @param bool $isSheetActive Whether the sheet was defined as active |
||
56 | * @param \Box\Spout\Common\Manager\OptionsManagerInterface $optionsManager Reader's options manager |
||
57 | * @param SharedStringsManager $sharedStringsManager Manages shared strings |
||
58 | * @return Sheet |
||
59 | */ |
||
60 | 34 | public function createSheet( |
|
73 | |||
74 | /** |
||
75 | * @param string $filePath Path of the XLSX file being read |
||
76 | * @param string $sheetDataXMLFilePath Path of the sheet data XML file as in [Content_Types].xml |
||
77 | * @param \Box\Spout\Common\Manager\OptionsManagerInterface $optionsManager Reader's options manager |
||
78 | * @param SharedStringsManager $sharedStringsManager Manages shared strings |
||
79 | * @return RowIterator |
||
80 | */ |
||
81 | 34 | private function createRowIterator($filePath, $sheetDataXMLFilePath, $optionsManager, $sharedStringsManager) |
|
82 | { |
||
83 | 34 | $xmlReader = $this->createXMLReader(); |
|
84 | 34 | $xmlProcessor = $this->createXMLProcessor($xmlReader); |
|
85 | |||
86 | 34 | $styleManager = $this->managerFactory->createStyleManager($filePath, $this); |
|
87 | 34 | $shouldFormatDates = $optionsManager->getOption(Options::SHOULD_FORMAT_DATES); |
|
88 | 34 | $shouldUse1904Dates = $optionsManager->getOption(Options::SHOULD_USE_1904_DATES); |
|
89 | |||
90 | 34 | $cellValueFormatter = $this->helperFactory->createCellValueFormatter( |
|
91 | 34 | $sharedStringsManager, |
|
92 | 34 | $styleManager, |
|
93 | 34 | $shouldFormatDates, |
|
94 | 34 | $shouldUse1904Dates |
|
95 | ); |
||
96 | |||
97 | 34 | $shouldPreserveEmptyRows = $optionsManager->getOption(Options::SHOULD_PRESERVE_EMPTY_ROWS); |
|
98 | |||
99 | 34 | return new RowIterator( |
|
100 | 34 | $filePath, |
|
101 | 34 | $sheetDataXMLFilePath, |
|
102 | 34 | $shouldPreserveEmptyRows, |
|
103 | 34 | $xmlReader, |
|
104 | 34 | $xmlProcessor, |
|
105 | 34 | $cellValueFormatter |
|
106 | ); |
||
107 | } |
||
108 | |||
109 | /** |
||
110 | * @return \ZipArchive |
||
111 | */ |
||
112 | 37 | public function createZipArchive() |
|
116 | |||
117 | /** |
||
118 | * @return XMLReader |
||
119 | */ |
||
120 | 42 | public function createXMLReader() |
|
124 | |||
125 | /** |
||
126 | * @param $xmlReader |
||
127 | * @return XMLProcessor |
||
128 | */ |
||
129 | 35 | public function createXMLProcessor($xmlReader) |
|
133 | } |
||
134 |