Total Complexity | 2 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
14 | class Decimal extends ValueObject |
||
15 | { |
||
16 | use SanitizesNumbers; |
||
17 | |||
18 | /** |
||
19 | * @var BigNumber |
||
20 | */ |
||
21 | protected BigNumber $number; |
||
22 | |||
23 | /** |
||
24 | * Create a new instance of the value object. |
||
25 | * |
||
26 | * @param int|float|string|null $number |
||
27 | * @param int $scale |
||
28 | */ |
||
29 | 12 | public function __construct(int|float|string|null $number, protected int $scale = 2) |
|
30 | { |
||
31 | 12 | $this->number = new BigNumber($this->sanitize($number), $this->scale); |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * Get the object value. |
||
36 | * |
||
37 | * @return string |
||
38 | */ |
||
39 | 11 | public function value(): string |
|
42 | } |
||
43 | } |
||
44 |