@@ -6,7 +6,7 @@ |
||
| 6 | 6 | * @see Mistralys\WidthsCalculator\Calculator\Column |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -declare (strict_types=1); |
|
| 9 | +declare(strict_types=1); |
|
| 10 | 10 | |
| 11 | 11 | namespace Mistralys\WidthsCalculator\Calculator; |
| 12 | 12 | |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @see Mistralys\WidthsCalculator\Calculator\OverflowFixer |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -declare (strict_types=1); |
|
| 9 | +declare(strict_types=1); |
|
| 10 | 10 | |
| 11 | 11 | namespace Mistralys\WidthsCalculator\Calculator; |
| 12 | 12 | |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $cols = $this->calculator->getColumns(); |
| 50 | 50 | |
| 51 | - foreach($cols as $col) |
|
| 51 | + foreach ($cols as $col) |
|
| 52 | 52 | { |
| 53 | 53 | // no change for missing columns, they get filled later |
| 54 | - if($col->isMissing()) |
|
| 54 | + if ($col->isMissing()) |
|
| 55 | 55 | { |
| 56 | 56 | continue; |
| 57 | 57 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @see Mistralys\WidthsCalculator\Calculator\SurplusRemover |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -declare (strict_types=1); |
|
| 9 | +declare(strict_types=1); |
|
| 10 | 10 | |
| 11 | 11 | namespace Mistralys\WidthsCalculator\Calculator; |
| 12 | 12 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | $this->leftover = $this->calculator->getMaxTotal() - $this->operations->calcTotal(); |
| 54 | 54 | |
| 55 | - if($this->leftover >= 0) |
|
| 55 | + if ($this->leftover >= 0) |
|
| 56 | 56 | { |
| 57 | 57 | return; |
| 58 | 58 | } |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | $this->baseTotal = $this->operations->calcTotalNotMissing(); |
| 62 | 62 | $cols = $this->calculator->getColumns(); |
| 63 | 63 | |
| 64 | - foreach($cols as $col) |
|
| 64 | + foreach ($cols as $col) |
|
| 65 | 65 | { |
| 66 | - if(!$this->processColumn($col)) |
|
| 66 | + if (!$this->processColumn($col)) |
|
| 67 | 67 | { |
| 68 | 68 | break; |
| 69 | 69 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | // |
| 77 | 77 | // We simply run the removal again, to remove the |
| 78 | 78 | // surplus from the columns it can be removed from. |
| 79 | - if($this->leftover > 0) |
|
| 79 | + if ($this->leftover > 0) |
|
| 80 | 80 | { |
| 81 | 81 | $this->remove(); |
| 82 | 82 | } |
@@ -84,12 +84,12 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | private function processColumn(Column $col) : bool |
| 86 | 86 | { |
| 87 | - if($col->isMissing()) |
|
| 87 | + if ($col->isMissing()) |
|
| 88 | 88 | { |
| 89 | 89 | return true; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if($this->leftover <= 0) |
|
| 92 | + if ($this->leftover <= 0) |
|
| 93 | 93 | { |
| 94 | 94 | return false; |
| 95 | 95 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $amount = round($this->leftover * $percent / 100); |
| 99 | 99 | $val = $col->getValue() - $amount; |
| 100 | 100 | |
| 101 | - if($val < $this->calculator->getMinWidth()) |
|
| 101 | + if ($val < $this->calculator->getMinWidth()) |
|
| 102 | 102 | { |
| 103 | 103 | return true; |
| 104 | 104 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @see Mistralys\WidthsCalculator\Calculator\Operations |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -declare (strict_types=1); |
|
| 9 | +declare(strict_types=1); |
|
| 10 | 10 | |
| 11 | 11 | namespace Mistralys\WidthsCalculator\Calculator; |
| 12 | 12 | |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | $this->columns = $calculator->getColumns(); |
| 48 | 48 | $this->amountCols = count($this->columns); |
| 49 | 49 | |
| 50 | - foreach($this->columns as $col) |
|
| 50 | + foreach ($this->columns as $col) |
|
| 51 | 51 | { |
| 52 | - if($col->isMissing()) |
|
| 52 | + if ($col->isMissing()) |
|
| 53 | 53 | { |
| 54 | 54 | $this->missing++; |
| 55 | 55 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | $total = 0; |
| 62 | 62 | |
| 63 | - foreach($this->columns as $col) |
|
| 63 | + foreach ($this->columns as $col) |
|
| 64 | 64 | { |
| 65 | 65 | $total += $col->getValue(); |
| 66 | 66 | } |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | $total = 0; |
| 84 | 84 | |
| 85 | - foreach($this->columns as $col) |
|
| 85 | + foreach ($this->columns as $col) |
|
| 86 | 86 | { |
| 87 | - if(!$col->isMissing()) |
|
| 87 | + if (!$col->isMissing()) |
|
| 88 | 88 | { |
| 89 | 89 | $total += $col->getValue(); |
| 90 | 90 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @see Mistralys\WidthsCalculator\Calculator\MissingFiller |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -declare (strict_types=1); |
|
| 9 | +declare(strict_types=1); |
|
| 10 | 10 | |
| 11 | 11 | namespace Mistralys\WidthsCalculator\Calculator; |
| 12 | 12 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public function fill() : void |
| 46 | 46 | { |
| 47 | - if($this->missing === 0) |
|
| 47 | + if ($this->missing === 0) |
|
| 48 | 48 | { |
| 49 | 49 | return; |
| 50 | 50 | } |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $cols = $this->calculator->getColumns(); |
| 60 | 60 | |
| 61 | - foreach($cols as $col) |
|
| 61 | + foreach ($cols as $col) |
|
| 62 | 62 | { |
| 63 | - if($col->isMissing()) |
|
| 63 | + if ($col->isMissing()) |
|
| 64 | 64 | { |
| 65 | 65 | $col->setValue($perColumn); |
| 66 | 66 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $toDistribute = $this->calculator->getMaxTotal() - $this->operations->calcTotal(); |
| 73 | 73 | |
| 74 | - if($toDistribute <= 0) |
|
| 74 | + if ($toDistribute <= 0) |
|
| 75 | 75 | { |
| 76 | 76 | $toDistribute = $this->calculator->getMinWidth() * $this->missing; |
| 77 | 77 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @see Mistralys\WidthsCalculator\Calculator\LeftoverFiller |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -declare (strict_types=1); |
|
| 9 | +declare(strict_types=1); |
|
| 10 | 10 | |
| 11 | 11 | namespace Mistralys\WidthsCalculator\Calculator; |
| 12 | 12 | |
@@ -40,14 +40,14 @@ discard block |
||
| 40 | 40 | $leftover = $this->calculator->getMaxTotal() - $this->operations->calcTotal(); |
| 41 | 41 | $perCol = $leftover / $this->operations->countColumns(); |
| 42 | 42 | |
| 43 | - if($this->calculator->isIntegerMode()) |
|
| 43 | + if ($this->calculator->isIntegerMode()) |
|
| 44 | 44 | { |
| 45 | 45 | $perCol = (int)ceil($perCol); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - for($i=($this->operations->countColumns()-1); $i >=0; $i--) |
|
| 48 | + for ($i = ($this->operations->countColumns() - 1); $i >= 0; $i--) |
|
| 49 | 49 | { |
| 50 | - if($leftover <= 0) |
|
| 50 | + if ($leftover <= 0) |
|
| 51 | 51 | { |
| 52 | 52 | break; |
| 53 | 53 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | private function cleanUp(float $leftover) : void |
| 75 | 75 | { |
| 76 | - if($leftover >= 0 || empty($this->columns)) |
|
| 76 | + if ($leftover >= 0 || empty($this->columns)) |
|
| 77 | 77 | { |
| 78 | 78 | return; |
| 79 | 79 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @see Mistralys\WidthsCalculator\Calculator |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -declare (strict_types=1); |
|
| 9 | +declare(strict_types=1); |
|
| 10 | 10 | |
| 11 | 11 | namespace Mistralys\WidthsCalculator; |
| 12 | 12 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | private function __construct(array $columnValues) |
| 59 | 59 | { |
| 60 | - foreach($columnValues as $name => $value) |
|
| 60 | + foreach ($columnValues as $name => $value) |
|
| 61 | 61 | { |
| 62 | 62 | $this->addColumn( |
| 63 | 63 | (string)$name, |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | return $this->operations; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public function setFloatValues(bool $enable=true) : Calculator |
|
| 110 | + public function setFloatValues(bool $enable = true) : Calculator |
|
| 111 | 111 | { |
| 112 | 112 | $this->setOption('integerValues', !$enable); |
| 113 | 113 | return $this; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | { |
| 126 | 126 | $max = $this->getMaxMinWidth(); |
| 127 | 127 | |
| 128 | - if($width > $max) |
|
| 128 | + if ($width > $max) |
|
| 129 | 129 | { |
| 130 | 130 | throw new \Exception( |
| 131 | 131 | sprintf('Minimum width cannot be set above %s.', number_format($max, 4)), |
@@ -163,12 +163,12 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | private function calculate() : void |
| 165 | 165 | { |
| 166 | - if($this->calculated) |
|
| 166 | + if ($this->calculated) |
|
| 167 | 167 | { |
| 168 | 168 | return; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if($this->operations->calcTotal() > $this->getMaxTotal()) |
|
| 171 | + if ($this->operations->calcTotal() > $this->getMaxTotal()) |
|
| 172 | 172 | { |
| 173 | 173 | $this->fixOverflow(); |
| 174 | 174 | } |
@@ -189,9 +189,9 @@ discard block |
||
| 189 | 189 | private function convertToInteger() : void |
| 190 | 190 | { |
| 191 | 191 | // convert all columns to integer values as required |
| 192 | - if($this->isIntegerMode()) |
|
| 192 | + if ($this->isIntegerMode()) |
|
| 193 | 193 | { |
| 194 | - foreach($this->columns as $col) |
|
| 194 | + foreach ($this->columns as $col) |
|
| 195 | 195 | { |
| 196 | 196 | $val = intval(floor($col->getValue())); |
| 197 | 197 | $col->setValue(floatval($val)); |
@@ -211,11 +211,11 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | $result = array(); |
| 213 | 213 | |
| 214 | - foreach($this->columns as $col) |
|
| 214 | + foreach ($this->columns as $col) |
|
| 215 | 215 | { |
| 216 | 216 | $val = $col->getValue(); |
| 217 | 217 | |
| 218 | - if($this->isIntegerMode()) |
|
| 218 | + if ($this->isIntegerMode()) |
|
| 219 | 219 | { |
| 220 | 220 | $val = intval($val); |
| 221 | 221 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $values = $calc->getValues(); |
| 246 | 246 | |
| 247 | 247 | $result = array(); |
| 248 | - foreach($values as $name => $value) |
|
| 248 | + foreach ($values as $name => $value) |
|
| 249 | 249 | { |
| 250 | 250 | $result[$name] = (int)$value; |
| 251 | 251 | } |