@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function __construct(float $amount) |
33 | 33 | { |
34 | - if($amount < 0) { |
|
34 | + if ($amount < 0) { |
|
35 | 35 | throw new \OutOfBoundsException('Only positive ammount more then zero allowed'); |
36 | 36 | } |
37 | 37 | $this->amount = $amount; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $value = self::convert($unit->getAmount(), $unit->getDimensionCode(), $this->getDimensionCode()); |
78 | 78 | $result = $this->getAmount() - $value; |
79 | 79 | |
80 | - if($result < 0) { |
|
80 | + if ($result < 0) { |
|
81 | 81 | throw new \OutOfBoundsException('Cannot subtract, less or equal zero result'); |
82 | 82 | } |
83 | 83 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | public function divide(float $number) : self |
108 | 108 | { |
109 | 109 | /** @noinspection TypeUnsafeComparisonInspection */ |
110 | - if($number == 0) { |
|
110 | + if ($number == 0) { |
|
111 | 111 | throw new \OutOfBoundsException('Cannot divide on zero'); |
112 | 112 | } |
113 | 113 | $this->amount /= $number; |
@@ -179,16 +179,16 @@ discard block |
||
179 | 179 | */ |
180 | 180 | protected static function convert(float $value, int $fromDimension, int $toDimension) : float |
181 | 181 | { |
182 | - if($fromDimension > $toDimension) { |
|
182 | + if ($fromDimension > $toDimension) { |
|
183 | 183 | $numberOfMultiplies = $fromDimension - $toDimension; |
184 | - for($i = 0; $i < $numberOfMultiplies; $i++) { |
|
184 | + for ($i = 0; $i < $numberOfMultiplies; $i++) { |
|
185 | 185 | $value *= self::$multiplier; |
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
189 | - if($fromDimension < $toDimension) { |
|
189 | + if ($fromDimension < $toDimension) { |
|
190 | 190 | $numberOfDivides = $toDimension - $fromDimension; |
191 | - for($i = 0; $i < $numberOfDivides; $i++) { |
|
191 | + for ($i = 0; $i < $numberOfDivides; $i++) { |
|
192 | 192 | $value /= self::$multiplier; |
193 | 193 | } |
194 | 194 | } |