@@ -49,7 +49,7 @@ |
||
| 49 | 49 | $sum = $quantity->multiply((string) -$this->rate); |
| 50 | 50 | $currency = strtoupper($sum->getUnit()->getName()); |
| 51 | 51 | |
| 52 | - return Money::{$currency}((int)floor($sum->getQuantity())); |
|
| 52 | + return Money::{$currency}((int) floor($sum->getQuantity())); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function calculatePrice(QuantityInterface $quantity): ?Money |
@@ -45,9 +45,9 @@ |
||
| 45 | 45 | public static function createFromObjects(Money $price, Quantity $quantity): self |
| 46 | 46 | { |
| 47 | 47 | return new self( |
| 48 | - (string)((int)$price->getAmount() / 100), // TODO: Might be not 100 for some currencies |
|
| 48 | + (string) ((int) $price->getAmount() / 100), // TODO: Might be not 100 for some currencies |
|
| 49 | 49 | $price->getCurrency()->getCode(), |
| 50 | - (string)$quantity->getQuantity(), |
|
| 50 | + (string) $quantity->getQuantity(), |
|
| 51 | 51 | $quantity->getUnit()->getName() |
| 52 | 52 | ); |
| 53 | 53 | } |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $this->billedUsage->getQuantity(), |
| 30 | 30 | $this->billedUsage->getUnit()->getName(), |
| 31 | 31 | $this->threshold->getRawPrice(), |
| 32 | - number_format($this->charged->getAmount()/100, 2), |
|
| 32 | + number_format($this->charged->getAmount() / 100, 2), |
|
| 33 | 33 | ); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public static function fromScalarsArray(array $thresholds): self |
| 41 | 41 | { |
| 42 | - return new self(array_map(function ($threshold) { |
|
| 42 | + return new self(array_map(function($threshold) { |
|
| 43 | 43 | return ProgressivePriceThreshold::createFromScalar( |
| 44 | 44 | $threshold['price'], |
| 45 | 45 | $threshold['currency'], |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | private function prepareThresholds(): void |
| 84 | 84 | { |
| 85 | - usort($this->thresholds, function (ProgressivePriceThreshold $a, ProgressivePriceThreshold $b) { |
|
| 85 | + usort($this->thresholds, function(ProgressivePriceThreshold $a, ProgressivePriceThreshold $b) { |
|
| 86 | 86 | if ($b->quantity()->convert($a->quantity()->getUnit())->equals($a->quantity())) { |
| 87 | 87 | return $b->price()->getAmount() <=> $a->price()->getAmount(); |
| 88 | 88 | } |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | { |
| 24 | 24 | $diff = $time->diff($since); |
| 25 | 25 | |
| 26 | - return ($diff->m + $diff->y*12) / $this->value; |
|
| 26 | + return ($diff->m + $diff->y * 12) / $this->value; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | public function addTo(DateTimeImmutable $since): DateTimeImmutable |
@@ -109,7 +109,7 @@ |
||
| 109 | 109 | throw new FormulaSemanticsError('multiplier for discount must be numeric'); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - return new static($this->isAbsolute() ? $this->value->multiply((string)$multiplier) : $this->getValue()*$multiplier); |
|
| 112 | + return new static($this->isAbsolute() ? $this->value->multiply((string) $multiplier) : $this->getValue() * $multiplier); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | public function add($addend) |
@@ -26,6 +26,6 @@ |
||
| 26 | 26 | { |
| 27 | 27 | return $this->value instanceof Money |
| 28 | 28 | ? $this->value |
| 29 | - : $charge->getSum()->multiply(sprintf('%.14F', $this->value*0.01)); |
|
| 29 | + : $charge->getSum()->multiply(sprintf('%.14F', $this->value * 0.01)); |
|
| 30 | 30 | } |
| 31 | 31 | } |
@@ -27,12 +27,12 @@ |
||
| 27 | 27 | return $this->multiply($num)->add($start); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - $start = $start->getValue()/100.0; |
|
| 31 | - $factor = $this->getValue()/100.0; |
|
| 30 | + $start = $start->getValue() / 100.0; |
|
| 31 | + $factor = $this->getValue() / 100.0; |
|
| 32 | 32 | |
| 33 | - $value = 1 - (1 - $start)*pow(1 - $factor, $num); |
|
| 33 | + $value = 1 - (1 - $start) * pow(1 - $factor, $num); |
|
| 34 | 34 | |
| 35 | - return new Discount($value*100); |
|
| 35 | + return new Discount($value * 100); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function inverted(): self |
@@ -128,7 +128,7 @@ |
||
| 128 | 128 | public function normalize(string $formula): ?string |
| 129 | 129 | { |
| 130 | 130 | $lines = explode(self::FORMULAS_SEPARATOR, $formula); |
| 131 | - $normalized = array_map(function ($value) { |
|
| 131 | + $normalized = array_map(function($value) { |
|
| 132 | 132 | $value = trim($value); |
| 133 | 133 | if ('' === $value) { |
| 134 | 134 | return null; |