1 | <?php |
||
23 | abstract class WriterMultiSheetsAbstract extends WriterAbstract |
||
24 | { |
||
25 | /** @var ManagerFactoryInterface */ |
||
26 | private $managerFactory; |
||
27 | |||
28 | /** @var WorkbookManagerInterface */ |
||
29 | private $workbookManager; |
||
30 | |||
31 | /** |
||
32 | * @param OptionsManagerInterface $optionsManager |
||
33 | * @param GlobalFunctionsHelper $globalFunctionsHelper |
||
34 | * @param HelperFactory $helperFactory |
||
35 | * @param ManagerFactoryInterface $managerFactory |
||
36 | */ |
||
37 | 87 | public function __construct( |
|
46 | |||
47 | /** |
||
48 | * Sets whether new sheets should be automatically created when the max rows limit per sheet is reached. |
||
49 | * This must be set before opening the writer. |
||
50 | * |
||
51 | * @param bool $shouldCreateNewSheetsAutomatically Whether new sheets should be automatically created when the max rows limit per sheet is reached |
||
52 | * @throws WriterAlreadyOpenedException If the writer was already opened |
||
53 | * @return WriterMultiSheetsAbstract |
||
54 | */ |
||
55 | 31 | public function setShouldCreateNewSheetsAutomatically($shouldCreateNewSheetsAutomatically) |
|
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | 77 | protected function openWriter() |
|
74 | |||
75 | /** |
||
76 | * Returns all the workbook's sheets |
||
77 | * |
||
78 | * @throws WriterNotOpenedException If the writer has not been opened yet |
||
79 | * @return Sheet[] All the workbook's sheets |
||
80 | */ |
||
81 | 14 | public function getSheets() |
|
95 | |||
96 | /** |
||
97 | * Creates a new sheet and make it the current sheet. The data will now be written to this sheet. |
||
98 | * |
||
99 | * @throws WriterNotOpenedException If the writer has not been opened yet |
||
100 | * @return Sheet The created sheet |
||
101 | */ |
||
102 | 15 | public function addNewSheetAndMakeItCurrent() |
|
109 | |||
110 | /** |
||
111 | * Returns the current sheet |
||
112 | * |
||
113 | * @throws WriterNotOpenedException If the writer has not been opened yet |
||
114 | * @return Sheet The current sheet |
||
115 | */ |
||
116 | 10 | public function getCurrentSheet() |
|
122 | |||
123 | /** |
||
124 | * Sets the given sheet as the current one. New data will be written to this sheet. |
||
125 | * The writing will resume where it stopped (i.e. data won't be truncated). |
||
126 | * |
||
127 | * @param Sheet $sheet The sheet to set as current |
||
128 | * @throws WriterNotOpenedException If the writer has not been opened yet |
||
129 | * @throws SheetNotFoundException If the given sheet does not exist in the workbook |
||
130 | * @return void |
||
131 | */ |
||
132 | 4 | public function setCurrentSheet($sheet) |
|
137 | |||
138 | /** |
||
139 | * Checks if the workbook has been created. Throws an exception if not created yet. |
||
140 | * |
||
141 | * @throws WriterNotOpenedException If the workbook is not created yet |
||
142 | * @return void |
||
143 | */ |
||
144 | 69 | protected function throwIfWorkbookIsNotAvailable() |
|
150 | |||
151 | /** |
||
152 | * {@inheritdoc} |
||
153 | */ |
||
154 | 63 | protected function addRowToWriter(Row $row) |
|
159 | |||
160 | /** |
||
161 | * {@inheritdoc} |
||
162 | */ |
||
163 | 70 | protected function closeWriter() |
|
169 | } |
||
170 |