@@ -24,9 +24,9 @@ |
||
24 | 24 | private int $amountCols; |
25 | 25 | private int $missing = 0; |
26 | 26 | |
27 | - /** |
|
28 | - * @var Column[] |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var Column[] |
|
29 | + */ |
|
30 | 30 | private array $columns; |
31 | 31 | |
32 | 32 | public function __construct(Calculator $calculator) |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | private Calculator $calculator; |
24 | 24 | private Operations $operations; |
25 | 25 | |
26 | - /** |
|
27 | - * @var Column[] |
|
28 | - */ |
|
26 | + /** |
|
27 | + * @var Column[] |
|
28 | + */ |
|
29 | 29 | private array $columns; |
30 | 30 | |
31 | 31 | public function __construct(Calculator $calculator) |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | $this->cleanUp($leftover); |
65 | 65 | } |
66 | 66 | |
67 | - /** |
|
68 | - * In integer mode, after filling all items, because of rounding |
|
69 | - * the amount of column up, we may have added a bit too much. We |
|
70 | - * fix this here, by removing it from the last column. |
|
71 | - * |
|
72 | - * @param float $leftover |
|
73 | - */ |
|
67 | + /** |
|
68 | + * In integer mode, after filling all items, because of rounding |
|
69 | + * the amount of column up, we may have added a bit too much. We |
|
70 | + * fix this here, by removing it from the last column. |
|
71 | + * |
|
72 | + * @param float $leftover |
|
73 | + */ |
|
74 | 74 | private function cleanUp(float $leftover) : void |
75 | 75 | { |
76 | 76 | if($leftover >= 0 || empty($this->columns)) |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | |
38 | 38 | use Traits_Optionable; |
39 | 39 | |
40 | - /** |
|
41 | - * @var Column[] |
|
42 | - */ |
|
40 | + /** |
|
41 | + * @var Column[] |
|
42 | + */ |
|
43 | 43 | private $columns = array(); |
44 | 44 | |
45 | - /** |
|
46 | - * @var boolean |
|
47 | - */ |
|
45 | + /** |
|
46 | + * @var boolean |
|
47 | + */ |
|
48 | 48 | private $calculated = false; |
49 | 49 | |
50 | - /** |
|
51 | - * @var Operations |
|
52 | - */ |
|
50 | + /** |
|
51 | + * @var Operations |
|
52 | + */ |
|
53 | 53 | private $operations; |
54 | 54 | |
55 | - /** |
|
56 | - * @param array<string,float> $columnValues |
|
57 | - */ |
|
55 | + /** |
|
56 | + * @param array<string,float> $columnValues |
|
57 | + */ |
|
58 | 58 | private function __construct(array $columnValues) |
59 | 59 | { |
60 | 60 | foreach($columnValues as $name => $value) |
@@ -68,20 +68,20 @@ discard block |
||
68 | 68 | $this->operations = new Operations($this); |
69 | 69 | } |
70 | 70 | |
71 | - /** |
|
72 | - * Creates an instance of the calculator. |
|
73 | - * |
|
74 | - * @param array<string,float> $columnValues |
|
75 | - * @return Calculator |
|
76 | - */ |
|
71 | + /** |
|
72 | + * Creates an instance of the calculator. |
|
73 | + * |
|
74 | + * @param array<string,float> $columnValues |
|
75 | + * @return Calculator |
|
76 | + */ |
|
77 | 77 | public static function create(array $columnValues) : Calculator |
78 | 78 | { |
79 | 79 | return new Calculator($columnValues); |
80 | 80 | } |
81 | 81 | |
82 | - /** |
|
83 | - * @return array<string,mixed> |
|
84 | - */ |
|
82 | + /** |
|
83 | + * @return array<string,mixed> |
|
84 | + */ |
|
85 | 85 | public function getDefaultOptions(): array |
86 | 86 | { |
87 | 87 | return array( |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | return $this; |
114 | 114 | } |
115 | 115 | |
116 | - /** |
|
117 | - * Sets the minimum width to enforce for columns, |
|
118 | - * when there already are other columns that take |
|
119 | - * up all the available width. |
|
120 | - * |
|
121 | - * @param float $width |
|
122 | - * @return Calculator |
|
123 | - */ |
|
116 | + /** |
|
117 | + * Sets the minimum width to enforce for columns, |
|
118 | + * when there already are other columns that take |
|
119 | + * up all the available width. |
|
120 | + * |
|
121 | + * @param float $width |
|
122 | + * @return Calculator |
|
123 | + */ |
|
124 | 124 | public function setMinWidth(float $width) : Calculator |
125 | 125 | { |
126 | 126 | $max = $this->getMaxMinWidth(); |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | $this->columns[] = $col; |
153 | 153 | } |
154 | 154 | |
155 | - /** |
|
156 | - * Retrieves the minimum width for columns, in percent. |
|
157 | - * @return float |
|
158 | - */ |
|
155 | + /** |
|
156 | + * Retrieves the minimum width for columns, in percent. |
|
157 | + * @return float |
|
158 | + */ |
|
159 | 159 | public function getMinWidth() : float |
160 | 160 | { |
161 | 161 | return floatval($this->getOption('minPerCol')); |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | $this->calculated = true; |
182 | 182 | } |
183 | 183 | |
184 | - /** |
|
185 | - * Adjusts the individual column values to match |
|
186 | - * the expected output format, for example ensuring |
|
187 | - * integer values if we are in integer mode. |
|
188 | - */ |
|
184 | + /** |
|
185 | + * Adjusts the individual column values to match |
|
186 | + * the expected output format, for example ensuring |
|
187 | + * integer values if we are in integer mode. |
|
188 | + */ |
|
189 | 189 | private function convertToInteger() : void |
190 | 190 | { |
191 | 191 | // convert all columns to integer values as required |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | - /** |
|
203 | - * Retrieves the updated list of column values, |
|
204 | - * retaining the original keys. |
|
205 | - * |
|
206 | - * @return array<string,int|float> |
|
207 | - */ |
|
202 | + /** |
|
203 | + * Retrieves the updated list of column values, |
|
204 | + * retaining the original keys. |
|
205 | + * |
|
206 | + * @return array<string,int|float> |
|
207 | + */ |
|
208 | 208 | public function getValues() : array |
209 | 209 | { |
210 | 210 | $this->calculate(); |
@@ -231,13 +231,13 @@ discard block |
||
231 | 231 | return $this->getBoolOption('integerValues'); |
232 | 232 | } |
233 | 233 | |
234 | - /** |
|
235 | - * Retrieves the column values as pixel values, based on |
|
236 | - * the target available pixel width. |
|
237 | - * |
|
238 | - * @param int $targetWidth |
|
239 | - * @return array<string,int> |
|
240 | - */ |
|
234 | + /** |
|
235 | + * Retrieves the column values as pixel values, based on |
|
236 | + * the target available pixel width. |
|
237 | + * |
|
238 | + * @param int $targetWidth |
|
239 | + * @return array<string,int> |
|
240 | + */ |
|
241 | 241 | public function getPixelValues(int $targetWidth) : array |
242 | 242 | { |
243 | 243 | $calc = self::create($this->getValues()); |
@@ -253,9 +253,9 @@ discard block |
||
253 | 253 | return $result; |
254 | 254 | } |
255 | 255 | |
256 | - /** |
|
257 | - * @return Column[] |
|
258 | - */ |
|
256 | + /** |
|
257 | + * @return Column[] |
|
258 | + */ |
|
259 | 259 | public function getColumns() : array |
260 | 260 | { |
261 | 261 | return $this->columns; |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | $surplus->remove(); |
268 | 268 | } |
269 | 269 | |
270 | - /** |
|
271 | - * Detects any leftover percentages that still need |
|
272 | - * to be filled, in case we are not at 100% yet. It |
|
273 | - * distributes the missing percentages evenly over the |
|
274 | - * available columns, from the last one upwards. |
|
275 | - */ |
|
270 | + /** |
|
271 | + * Detects any leftover percentages that still need |
|
272 | + * to be filled, in case we are not at 100% yet. It |
|
273 | + * distributes the missing percentages evenly over the |
|
274 | + * available columns, from the last one upwards. |
|
275 | + */ |
|
276 | 276 | private function fillLeftover() : void |
277 | 277 | { |
278 | 278 | $filler = new LeftoverFiller($this); |