1 | <?php |
||
7 | class Currency |
||
8 | { |
||
9 | /** |
||
10 | * @var string $code ISO 4217 alpha3 currency code |
||
11 | */ |
||
12 | private $code; |
||
13 | |||
14 | /** |
||
15 | * @var integer $fractionDigits |
||
16 | */ |
||
17 | private $fractionDigits; |
||
18 | |||
19 | /** |
||
20 | * @param string $code ISO 4217 alpha3 currency code |
||
21 | */ |
||
22 | 10 | public function __construct($code) |
|
23 | { |
||
24 | 10 | $this->code = $code; |
|
25 | 10 | $this->fractionDigits = Intl::getCurrencyBundle()->getFractionDigits($code); |
|
26 | 10 | } |
|
27 | |||
28 | /** |
||
29 | * @return string |
||
30 | */ |
||
31 | 1 | public function __toString() |
|
32 | { |
||
33 | 1 | return $this->code; |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * @return string |
||
38 | */ |
||
39 | 5 | public function getCode() |
|
43 | |||
44 | /** |
||
45 | * @return integer |
||
46 | */ |
||
47 | 6 | public function getFractionDigits() |
|
51 | } |
||
52 |