@@ -32,34 +32,34 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | use Traits_Optionable; |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var integer |
|
| 37 | - */ |
|
| 35 | + /** |
|
| 36 | + * @var integer |
|
| 37 | + */ |
|
| 38 | 38 | private $amountCols = 0; |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var integer |
|
| 42 | - */ |
|
| 40 | + /** |
|
| 41 | + * @var integer |
|
| 42 | + */ |
|
| 43 | 43 | private $maxTotal = 100; |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @var Column[] |
|
| 47 | - */ |
|
| 45 | + /** |
|
| 46 | + * @var Column[] |
|
| 47 | + */ |
|
| 48 | 48 | private $columns = array(); |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @var integer |
|
| 52 | - */ |
|
| 50 | + /** |
|
| 51 | + * @var integer |
|
| 52 | + */ |
|
| 53 | 53 | private $missing = 0; |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @var boolean |
|
| 57 | - */ |
|
| 55 | + /** |
|
| 56 | + * @var boolean |
|
| 57 | + */ |
|
| 58 | 58 | private $calculated = false; |
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @param string[]number $columnValues |
|
| 62 | - */ |
|
| 60 | + /** |
|
| 61 | + * @param string[]number $columnValues |
|
| 62 | + */ |
|
| 63 | 63 | private function __construct(array $columnValues) |
| 64 | 64 | { |
| 65 | 65 | foreach($columnValues as $name => $value) |
@@ -90,14 +90,14 @@ discard block |
||
| 90 | 90 | return $this; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - /** |
|
| 94 | - * Sets the minimum width to enforce for columns, |
|
| 95 | - * when there already are other columns that take |
|
| 96 | - * up all the available width. |
|
| 97 | - * |
|
| 98 | - * @param float $width |
|
| 99 | - * @return Calculator |
|
| 100 | - */ |
|
| 93 | + /** |
|
| 94 | + * Sets the minimum width to enforce for columns, |
|
| 95 | + * when there already are other columns that take |
|
| 96 | + * up all the available width. |
|
| 97 | + * |
|
| 98 | + * @param float $width |
|
| 99 | + * @return Calculator |
|
| 100 | + */ |
|
| 101 | 101 | public function setMinWidth(float $width) : Calculator |
| 102 | 102 | { |
| 103 | 103 | $max = $this->getMaxMinWidth(); |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | $this->columns[] = $col; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - /** |
|
| 141 | - * Retrieves the minimum width for columns, in percent. |
|
| 142 | - * @return float |
|
| 143 | - */ |
|
| 140 | + /** |
|
| 141 | + * Retrieves the minimum width for columns, in percent. |
|
| 142 | + * @return float |
|
| 143 | + */ |
|
| 144 | 144 | public function getMinWidth() : float |
| 145 | 145 | { |
| 146 | 146 | return floatval($this->getOption('minPerCol')); |
@@ -165,12 +165,12 @@ discard block |
||
| 165 | 165 | $this->calculated = true; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - /** |
|
| 169 | - * Retrieves the updated list of column values, |
|
| 170 | - * retaining the original keys. |
|
| 171 | - * |
|
| 172 | - * @return array |
|
| 173 | - */ |
|
| 168 | + /** |
|
| 169 | + * Retrieves the updated list of column values, |
|
| 170 | + * retaining the original keys. |
|
| 171 | + * |
|
| 172 | + * @return array |
|
| 173 | + */ |
|
| 174 | 174 | public function getValues() : array |
| 175 | 175 | { |
| 176 | 176 | $this->calculate(); |
@@ -264,12 +264,12 @@ discard block |
||
| 264 | 264 | return $total; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - /** |
|
| 268 | - * Detects any leftover percentages that still need |
|
| 269 | - * to be filled, in case we are not at 100% yet. It |
|
| 270 | - * distributes the missing percentages evenly over the |
|
| 271 | - * available columns, from the last one upwards. |
|
| 272 | - */ |
|
| 267 | + /** |
|
| 268 | + * Detects any leftover percentages that still need |
|
| 269 | + * to be filled, in case we are not at 100% yet. It |
|
| 270 | + * distributes the missing percentages evenly over the |
|
| 271 | + * available columns, from the last one upwards. |
|
| 272 | + */ |
|
| 273 | 273 | private function fillLeftover() : void |
| 274 | 274 | { |
| 275 | 275 | $this->adjustLeftoverValues(); |
@@ -299,11 +299,11 @@ discard block |
||
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | - /** |
|
| 303 | - * Adjusts the individual column values to match |
|
| 304 | - * the expected output format, for example ensuring |
|
| 305 | - * integer values if we are in integer mode. |
|
| 306 | - */ |
|
| 302 | + /** |
|
| 303 | + * Adjusts the individual column values to match |
|
| 304 | + * the expected output format, for example ensuring |
|
| 305 | + * integer values if we are in integer mode. |
|
| 306 | + */ |
|
| 307 | 307 | private function adjustLeftoverValues() : void |
| 308 | 308 | { |
| 309 | 309 | // convert all columns to integer values as required |
@@ -20,24 +20,24 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class Column |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var Calculator |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * @var Calculator |
|
| 25 | + */ |
|
| 26 | 26 | private $calculator; |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @var string |
|
| 30 | - */ |
|
| 28 | + /** |
|
| 29 | + * @var string |
|
| 30 | + */ |
|
| 31 | 31 | private $name; |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @var float |
|
| 35 | - */ |
|
| 33 | + /** |
|
| 34 | + * @var float |
|
| 35 | + */ |
|
| 36 | 36 | private $value; |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @var boolean |
|
| 40 | - */ |
|
| 38 | + /** |
|
| 39 | + * @var boolean |
|
| 40 | + */ |
|
| 41 | 41 | private $missing = false; |
| 42 | 42 | |
| 43 | 43 | public function __construct(Calculator $calculator, string $name, float $value) |