1 | <?php |
||
2 | |||
3 | namespace ICanBoogie\CLDR\Numbers; |
||
4 | |||
5 | /** |
||
6 | * @internal |
||
7 | * |
||
8 | * @link https://www.unicode.org/reports/tr35/tr35-72/tr35-numbers.html#Supplemental_Currency_Data |
||
9 | */ |
||
10 | final class Fraction |
||
11 | { |
||
12 | /** |
||
13 | * @param array{ _digits?: string, _rounding?: string, _cashDigits?: string, _cashRounding?: string } $data |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
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( |
||
39 | public readonly int $digits, |
||
40 | public readonly int $rounding, |
||
41 | public readonly int $cash_digits, |
||
42 | public readonly int $cash_rounding |
||
43 | ) { |
||
44 | } |
||
45 | } |
||
46 |