1 | <?php |
||
9 | class ColumnWidths |
||
10 | { |
||
11 | protected $widths; |
||
12 | |||
13 | public function __construct($widths = []) |
||
17 | |||
18 | public function paddingSpace( |
||
26 | |||
27 | /** |
||
28 | * Find all of the columns that are shorter than the specified threshold. |
||
29 | */ |
||
30 | public function findShortColumns($thresholdWidth) |
||
36 | |||
37 | /** |
||
38 | * Find all of the columns that are shorter than the corresponding minimum widths. |
||
39 | */ |
||
40 | public function findUndersizedColumns($minimumWidths) |
||
44 | |||
45 | protected function findColumnsUnderThreshold(array $thresholdWidths) |
||
56 | |||
57 | /** |
||
58 | * If the widths specified by this object do not fit within the |
||
59 | * provided avaiable width, then reduce them all proportionally. |
||
60 | */ |
||
61 | public function adjustMinimumWidths($availableWidth, $dataCellWidths) |
||
88 | |||
89 | /** |
||
90 | * Return proportional weights |
||
91 | */ |
||
92 | public function distribute($availableWidth) |
||
112 | |||
113 | public function lastColumn() |
||
118 | |||
119 | /** |
||
120 | * Return the number of columns. |
||
121 | */ |
||
122 | public function count() |
||
126 | |||
127 | /** |
||
128 | * Calculate how much space is available on average for all columns. |
||
129 | */ |
||
130 | public function averageWidth($availableWidth) |
||
134 | |||
135 | /** |
||
136 | * Return the available keys (column identifiers) from the calculated |
||
137 | * data set. |
||
138 | */ |
||
139 | public function keys() |
||
143 | |||
144 | /** |
||
145 | * Set the length of the specified column. |
||
146 | */ |
||
147 | public function setWidth($key, $width) |
||
151 | |||
152 | /** |
||
153 | * Return the length of the specified column. |
||
154 | */ |
||
155 | public function width($key) |
||
159 | |||
160 | /** |
||
161 | * Return all of the lengths |
||
162 | */ |
||
163 | public function widths() |
||
167 | |||
168 | /** |
||
169 | * Return true if there is no data in this object |
||
170 | */ |
||
171 | public function isEmpty() |
||
175 | |||
176 | /** |
||
177 | * Return the sum of the lengths of the provided widths. |
||
178 | */ |
||
179 | public function totalWidth() |
||
183 | |||
184 | /** |
||
185 | * Return the sum of the lengths of the provided widths. |
||
186 | */ |
||
187 | public static function sumWidth($widths) |
||
196 | |||
197 | /** |
||
198 | * Ensure that every item in $widths that has a corresponding entry |
||
199 | * in $minimumWidths is as least as large as the minimum value held there. |
||
200 | */ |
||
201 | public function enforceMinimums($minimumWidths) |
||
215 | |||
216 | /** |
||
217 | * Remove all of the specified columns from this data structure. |
||
218 | */ |
||
219 | public function removeColumns($columnKeys) |
||
229 | |||
230 | /** |
||
231 | * Select all columns that exist in the provided list of keys. |
||
232 | */ |
||
233 | public function selectColumns($columnKeys) |
||
243 | |||
244 | /** |
||
245 | * Combine this set of widths with another set, and return |
||
246 | * a new set that contains the entries from both. |
||
247 | */ |
||
248 | public function combine(ColumnWidths $combineWith) |
||
254 | } |
||
255 |