@@ -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; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | public function asHumanReadableString() : string |
| 184 | 184 | { |
| 185 | - return $this->getAmount() . ' ' . $this->getDimension(); |
|
| 185 | + return $this->getAmount().' '.$this->getDimension(); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -195,16 +195,16 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | protected static function convert(float $value, int $fromDimension, int $toDimension) : float |
| 197 | 197 | { |
| 198 | - if($fromDimension > $toDimension) { |
|
| 198 | + if ($fromDimension > $toDimension) { |
|
| 199 | 199 | $numberOfMultiplies = $fromDimension - $toDimension; |
| 200 | - for($i = 0; $i < $numberOfMultiplies; $i++) { |
|
| 200 | + for ($i = 0; $i < $numberOfMultiplies; $i++) { |
|
| 201 | 201 | $value *= self::$multiplier; |
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - if($fromDimension < $toDimension) { |
|
| 205 | + if ($fromDimension < $toDimension) { |
|
| 206 | 206 | $numberOfDivides = $toDimension - $fromDimension; |
| 207 | - for($i = 0; $i < $numberOfDivides; $i++) { |
|
| 207 | + for ($i = 0; $i < $numberOfDivides; $i++) { |
|
| 208 | 208 | $value /= self::$multiplier; |
| 209 | 209 | } |
| 210 | 210 | } |