Total Complexity | 2 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | final class Fraction |
||
11 | { |
||
12 | /** |
||
13 | * @param array{ _digits?: string, _rounding?: string, _cashDigits?: string, _cashRounding?: string } $data |
||
|
|||
14 | */ |
||
15 | public static function from(array $data): self |
||
16 | { |
||
17 | $digits = (int)($data['_digits'] ?? 2); |
||
18 | $rounding = (int)($data['_rounding'] ?? 0); |
||
19 | |||
20 | return new self( |
||
21 | $digits, |
||
22 | $rounding, |
||
23 | (int)($data['_cashDigits'] ?? $digits), |
||
24 | (int)($data['_cashRounding'] ?? $rounding) |
||
25 | ); |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @param int $digits |
||
30 | * The minimum and maximum number of decimal digits normally formatted. |
||
31 | * @param int $rounding |
||
32 | * The rounding increment, in units of 10^-digits. |
||
33 | * @param int $cash_digits |
||
34 | * The number of decimal digits to be used when formatting quantities used in cash transactions. |
||
35 | * @param int $cash_rounding |
||
36 | * The cash rounding increment, in units of 10^cashDigits. |
||
37 | */ |
||
38 | private function __construct( |
||
44 | } |
||
45 | } |
||
46 |