1 | <?php |
||
19 | class Currency |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * eg 'US' |
||
24 | * |
||
25 | * @var string $code |
||
26 | */ |
||
27 | private $code; |
||
28 | |||
29 | /** |
||
30 | * @var Label $label |
||
31 | */ |
||
32 | private $label; |
||
33 | |||
34 | /** |
||
35 | * currency sign |
||
36 | * |
||
37 | * @var string $sign |
||
38 | * eg '$' |
||
39 | */ |
||
40 | private $sign; |
||
41 | |||
42 | /** |
||
43 | * Whether the currency sign should come before the number or not |
||
44 | * |
||
45 | * @var boolean $sign_b4 |
||
46 | */ |
||
47 | private $sign_b4; |
||
48 | |||
49 | /** |
||
50 | * How many digits should come after the decimal place |
||
51 | * |
||
52 | * @var int $decimal_places |
||
53 | */ |
||
54 | private $decimal_places; |
||
55 | |||
56 | /** |
||
57 | * Symbol to use for decimal mark |
||
58 | * |
||
59 | * @var string $decimal_mark |
||
60 | * eg '.' |
||
61 | */ |
||
62 | private $decimal_mark; |
||
63 | |||
64 | /** |
||
65 | * Symbol to use for thousands |
||
66 | * |
||
67 | * @var string $thousands |
||
68 | * eg ',' |
||
69 | */ |
||
70 | private $thousands; |
||
71 | |||
72 | |||
73 | |||
74 | /** |
||
75 | * Currency constructor. |
||
76 | * |
||
77 | * @param string $code |
||
78 | * @param Label $label |
||
79 | * @param string $sign |
||
80 | * @param bool $sign_b4 |
||
81 | * @param int $decimal_places |
||
82 | * @param string $decimal_mark |
||
83 | * @param string $thousands |
||
84 | */ |
||
85 | public function __construct($code, Label $label, $sign, $sign_b4, $decimal_places, $decimal_mark, $thousands) |
||
95 | |||
96 | |||
97 | |||
98 | /** |
||
99 | * returns true if this currency is the same as the supplied currency |
||
100 | * |
||
101 | * @param Currency $other |
||
102 | * @return bool |
||
103 | */ |
||
104 | public function equals(Currency $other) |
||
108 | |||
109 | |||
110 | |||
111 | /** |
||
112 | * @return string |
||
113 | */ |
||
114 | public function code() |
||
118 | |||
119 | |||
120 | |||
121 | /** |
||
122 | * @return string |
||
123 | */ |
||
124 | public function name() |
||
128 | |||
129 | |||
130 | |||
131 | /** |
||
132 | * @return string |
||
133 | */ |
||
134 | public function plural() |
||
138 | |||
139 | |||
140 | |||
141 | /** |
||
142 | * @return string |
||
143 | */ |
||
144 | public function sign() |
||
148 | |||
149 | |||
150 | |||
151 | /** |
||
152 | * @return bool |
||
153 | */ |
||
154 | public function signB4() |
||
158 | |||
159 | |||
160 | |||
161 | /** |
||
162 | * @return int |
||
163 | */ |
||
164 | public function decimalPlaces() |
||
168 | |||
169 | |||
170 | |||
171 | /** |
||
172 | * @return string |
||
173 | */ |
||
174 | public function decimalMark() |
||
178 | |||
179 | |||
180 | |||
181 | /** |
||
182 | * @return string |
||
183 | */ |
||
184 | public function thousands() |
||
188 | |||
189 | |||
190 | |||
191 | /** |
||
192 | * @return string |
||
193 | */ |
||
194 | public function __toString() |
||
198 | |||
199 | |||
200 | |||
201 | } |
||
202 | // End of file Currency.php |
||
204 |