1 | <?php |
||
15 | class Sheet |
||
16 | { |
||
17 | /** |
||
18 | * @var CellBuilder |
||
19 | */ |
||
20 | private $cellBuilder; |
||
21 | |||
22 | /** |
||
23 | * @var WidthCalculator |
||
24 | */ |
||
25 | private $widthCalculator; |
||
26 | |||
27 | /** |
||
28 | * @var bool |
||
29 | */ |
||
30 | private $useCellAutosizing = false; |
||
31 | |||
32 | /** |
||
33 | * @var int |
||
34 | */ |
||
35 | private $freezePaneCellId; |
||
36 | |||
37 | /** |
||
38 | * Track next row index. |
||
39 | * |
||
40 | * @var int |
||
41 | */ |
||
42 | private $rowIndex = 1; |
||
43 | |||
44 | /** |
||
45 | * Holds width/column count of the widest row. |
||
46 | * |
||
47 | * @var int |
||
48 | */ |
||
49 | private $maxColumnCount; |
||
50 | |||
51 | /** |
||
52 | * Holds widths of the widest cells for column sizing. |
||
53 | * |
||
54 | * @var array |
||
55 | */ |
||
56 | private $columnWidths = array(); |
||
57 | |||
58 | /** |
||
59 | * Holds minimum allowed column width. |
||
60 | * |
||
61 | * @var array |
||
62 | */ |
||
63 | private $minColumnWidth; |
||
64 | |||
65 | /** |
||
66 | * Holds maximum allowed column width. |
||
67 | * |
||
68 | * @var array |
||
69 | */ |
||
70 | private $maxColumnWidth; |
||
71 | |||
72 | /** |
||
73 | * Sheet constructor. |
||
74 | * |
||
75 | * @param CellBuilder $cellBuilder |
||
76 | * @param WidthCalculator $widthCalculator |
||
77 | */ |
||
78 | 13 | public function __construct(CellBuilder $cellBuilder, WidthCalculator $widthCalculator) |
|
83 | |||
84 | /** |
||
85 | * Enable cell autosizing (~30% performance hit!). |
||
86 | */ |
||
87 | 5 | public function enableCellAutosizing() |
|
91 | |||
92 | /** |
||
93 | * Disable cell autosizing (default). |
||
94 | */ |
||
95 | 2 | public function disableCellAutosizing() |
|
99 | |||
100 | /** |
||
101 | * @param int $cellId |
||
102 | */ |
||
103 | 2 | public function setFreezePaneCellId($cellId) |
|
107 | |||
108 | /** |
||
109 | * Set custom column widths with 0 representing the first column. |
||
110 | * |
||
111 | * @param array $columnWidths |
||
112 | * @throws \InvalidArgumentException |
||
113 | */ |
||
114 | 4 | public function setFixedColumnWidths(array $columnWidths) |
|
124 | |||
125 | /** |
||
126 | * Set lower and/or upper limits for column widths. |
||
127 | * |
||
128 | * @param float|null $minWidth |
||
129 | * @param float|null $maxWidth |
||
130 | */ |
||
131 | public function setColumnWidthBoundries($minWidth = null, $maxWidth = null) |
||
136 | |||
137 | /** |
||
138 | * Return array containing all column widths, limited to min or max |
||
139 | * column width, if one or both of them are set. |
||
140 | * |
||
141 | * @return array |
||
142 | */ |
||
143 | public function getColumnWidths() |
||
153 | |||
154 | /** |
||
155 | * Return cellId for dimensions. |
||
156 | * |
||
157 | * @return string |
||
158 | */ |
||
159 | 1 | public function getDimensionUpperBound() |
|
163 | |||
164 | /** |
||
165 | * Add single row and style to sheet. |
||
166 | * |
||
167 | * @param array $row |
||
168 | * @param Style $style |
||
169 | * |
||
170 | * @return string |
||
171 | */ |
||
172 | 4 | public function addRow(array $row, Style $style) |
|
187 | |||
188 | /** |
||
189 | * Track column count for dimensions xml (e.g. A1:K123). |
||
190 | * |
||
191 | * @param int $columnCount |
||
192 | */ |
||
193 | 4 | private function updateMaxColumnCount($columnCount) |
|
199 | |||
200 | /** |
||
201 | * Get xml string for single cell and update cell widths. |
||
202 | * |
||
203 | * @param array $row |
||
204 | * @param Style $style |
||
205 | * @return string |
||
206 | */ |
||
207 | 4 | private function getCellXml(array $row, Style $style) |
|
219 | |||
220 | /** |
||
221 | * Track cell width for column width sizing if its enabled. |
||
222 | * |
||
223 | * @param mixed $value |
||
224 | * @param int $cellIndex |
||
225 | * @param Style $style |
||
226 | */ |
||
227 | 4 | private function updateColumnWidths($value, $cellIndex, Style $style) |
|
238 | |||
239 | /** |
||
240 | * Return freeze pane xml string for sheetView. |
||
241 | * |
||
242 | * @return string |
||
243 | */ |
||
244 | 2 | public function getFreezePaneXml() |
|
253 | } |
||
254 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..