Total Complexity | 5 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
11 | 1 | final class AmountDiscount 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 |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Returns price after discount. |
||
39 | 1 | */ |
|
40 | public function addDiscount(float $price): float |
||
41 | 1 | { |
|
42 | 1 | return $price - $this->value; |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * Returns price before discount. |
||
47 | */ |
||
48 | 1 | public function removeDiscount(float $price): float |
|
51 | } |
||
52 | } |
||
53 |