1 | <?php |
||
8 | class PhpSpreadsheetWrapper |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | const INSTANCE_KEY = '_tsb'; |
||
14 | |||
15 | /** |
||
16 | * Copies the PhpSpreadsheetWrapper instance from 'varargs' to '_tsb'. This is necessary for all Twig code running |
||
17 | * in sub-functions (e.g. block, macro, ...) since the root context is lost. To fix the sub-context a reference to |
||
18 | * the PhpSpreadsheetWrapper instance is included in all function calls. |
||
19 | * |
||
20 | * @param array $context |
||
21 | * |
||
22 | * @return array |
||
23 | */ |
||
24 | 106 | public static function fixContext(array $context): array |
|
36 | |||
37 | /** |
||
38 | * @var DocumentWrapper |
||
39 | */ |
||
40 | private $documentWrapper; |
||
41 | /** |
||
42 | * @var SheetWrapper |
||
43 | */ |
||
44 | private $sheetWrapper; |
||
45 | /** |
||
46 | * @var RowWrapper |
||
47 | */ |
||
48 | private $rowWrapper; |
||
49 | /** |
||
50 | * @var CellWrapper |
||
51 | */ |
||
52 | private $cellWrapper; |
||
53 | /** |
||
54 | * @var HeaderFooterWrapper |
||
55 | */ |
||
56 | private $headerFooterWrapper; |
||
57 | /** |
||
58 | * @var DrawingWrapper |
||
59 | */ |
||
60 | private $drawingWrapper; |
||
61 | |||
62 | /** |
||
63 | * PhpSpreadsheetWrapper constructor. |
||
64 | * |
||
65 | * @param array $context |
||
66 | * @param \Twig_Environment $environment |
||
67 | * @param array $attributes |
||
68 | */ |
||
69 | 118 | public function __construct(array $context, \Twig_Environment $environment, array $attributes = []) |
|
78 | |||
79 | /** |
||
80 | * @return int|null |
||
81 | */ |
||
82 | 4 | public function getCurrentColumn() |
|
86 | |||
87 | /** |
||
88 | * @return int|null |
||
89 | */ |
||
90 | 4 | public function getCurrentRow() |
|
94 | |||
95 | /** |
||
96 | * @param array $properties |
||
97 | * |
||
98 | * @throws \PhpOffice\PhpSpreadsheet\Exception |
||
99 | * @throws \PhpOffice\PhpSpreadsheet\Reader\Exception |
||
100 | * @throws \RuntimeException |
||
101 | */ |
||
102 | 118 | public function startDocument(array $properties = []) |
|
106 | |||
107 | /** |
||
108 | * @throws \RuntimeException |
||
109 | * @throws \LogicException |
||
110 | * @throws \InvalidArgumentException |
||
111 | * @throws \PhpOffice\PhpSpreadsheet\Exception |
||
112 | * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception |
||
113 | * @throws \Symfony\Component\Filesystem\Exception\IOException |
||
114 | */ |
||
115 | 110 | public function endDocument() |
|
119 | |||
120 | /** |
||
121 | * @param int|string|null $index |
||
122 | * @param array $properties |
||
123 | * |
||
124 | * @throws \LogicException |
||
125 | * @throws \PhpOffice\PhpSpreadsheet\Exception |
||
126 | * @throws \RuntimeException |
||
127 | */ |
||
128 | 106 | public function startSheet($index = null, array $properties = []) |
|
132 | |||
133 | /** |
||
134 | * @throws \LogicException |
||
135 | * @throws \Exception |
||
136 | */ |
||
137 | 98 | public function endSheet() |
|
141 | |||
142 | /** |
||
143 | * @param int|null $index |
||
144 | * |
||
145 | * @throws \LogicException |
||
146 | */ |
||
147 | 83 | public function startRow(int $index = null) |
|
151 | |||
152 | /** |
||
153 | * @throws \LogicException |
||
154 | */ |
||
155 | 79 | public function endRow() |
|
159 | |||
160 | /** |
||
161 | * @param int|null $index |
||
162 | * @param array $properties |
||
163 | * |
||
164 | * @throws \InvalidArgumentException |
||
165 | * @throws \LogicException |
||
166 | * @throws \RuntimeException |
||
167 | */ |
||
168 | 79 | public function startCell(int $index = null, array $properties = []) |
|
172 | |||
173 | /** |
||
174 | * @param null|mixed $value |
||
175 | * |
||
176 | * @throws \PhpOffice\PhpSpreadsheet\Exception |
||
177 | */ |
||
178 | 79 | public function setCellValue($value = null) |
|
182 | |||
183 | 79 | public function endCell() |
|
187 | |||
188 | /** |
||
189 | * @param string $baseType |
||
190 | * @param string|null $type |
||
191 | * @param array $properties |
||
192 | * |
||
193 | * @throws \LogicException |
||
194 | * @throws \RuntimeException |
||
195 | * @throws \InvalidArgumentException |
||
196 | */ |
||
197 | 5 | public function startHeaderFooter(string $baseType, string $type = null, array $properties = []) |
|
201 | |||
202 | /** |
||
203 | * @throws \LogicException |
||
204 | * @throws \InvalidArgumentException |
||
205 | */ |
||
206 | 5 | public function endHeaderFooter() |
|
210 | |||
211 | /** |
||
212 | * @param null|string $type |
||
213 | * @param array $properties |
||
214 | * |
||
215 | * @throws \InvalidArgumentException |
||
216 | * @throws \LogicException |
||
217 | */ |
||
218 | 5 | public function startAlignment(string $type = null, array $properties = []) |
|
222 | |||
223 | /** |
||
224 | * @param null|string $value |
||
225 | * |
||
226 | * @throws \InvalidArgumentException |
||
227 | * @throws \LogicException |
||
228 | */ |
||
229 | 5 | public function endAlignment(string $value = null) |
|
233 | |||
234 | /** |
||
235 | * @param string $path |
||
236 | * @param array $properties |
||
237 | * |
||
238 | * @throws \Symfony\Component\Filesystem\Exception\IOException |
||
239 | * @throws \InvalidArgumentException |
||
240 | * @throws \LogicException |
||
241 | * @throws \RuntimeException |
||
242 | * @throws \PhpOffice\PhpSpreadsheet\Exception |
||
243 | */ |
||
244 | 6 | public function startDrawing(string $path, array $properties = []) |
|
248 | |||
249 | 6 | public function endDrawing() |
|
253 | } |
||
254 |