| Total Complexity | 5 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 11 | 1 | final class PercentDiscount implements IDiscount |
|
| 12 | { |
||
| 13 | use SmartObject; |
||
| 14 | |||
| 15 | public function __construct( |
||
| 16 | protected float $value = 0.0 |
||
| 17 | ) { |
||
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Get discount value. |
||
| 22 | */ |
||
| 23 | public function getValue(): float |
||
| 24 | { |
||
| 25 | 1 | return $this->value; |
|
| 26 | 1 | } |
|
| 27 | |||
| 28 | /** |
||
| 29 | * Set discount value. |
||
| 30 | */ |
||
| 31 | public function setValue(float $value): IDiscount |
||
| 32 | { |
||
| 33 | 1 | $this->value = $value; |
|
| 34 | return $this; |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Returns price after discount. |
||
| 39 | 1 | */ |
|
| 40 | public function addDiscount(float $price): float |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Returns price before discount. |
||
| 47 | */ |
||
| 48 | 1 | public function removeDiscount(float $price): float |
|
| 53 |