-
Notifications
You must be signed in to change notification settings - Fork 9.4k
/
Copy pathCurrencyInterface.php
265 lines (238 loc) · 8.26 KB
/
CurrencyInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework;
use Magento\Framework\Currency\Exception\CurrencyException;
use Zend_Cache_Core;
/**
* @api
* @since 100.0.2
*/
interface CurrencyInterface
{
/**
* Returns a localized currency string
*
* @param int|float $value OPTIONAL Currency value
* @param array $options OPTIONAL options to set temporary
* @throws CurrencyException When the value is not a number
* @return string
*/
public function toCurrency($value = null, array $options = []);
/**
* Set the formatting options.
*
* Sets the formatting options of the localized currency string
* If no parameter is passed, the standard setting of the
* actual set locale will be used
*
* @param array $options (Optional) Options to set
* @return CurrencyInterface
*/
public function setFormat(array $options = []);
/**
* Returns the actual or details of other currency symbols, when no symbol is available it returns the shortname.
*
* @param string $currency OPTIONAL Currency name
* @param string $locale OPTIONAL Locale to display informations
* @return string
*/
public function getSymbol($currency = null, $locale = null);
/**
* Returns the actual or details of other currency shortnames
*
* @param string $currency OPTIONAL Currency's name
* @param string $locale OPTIONAL The locale
* @return string
*/
public function getShortName($currency = null, $locale = null);
/**
* Returns the actual or details of other currency names
*
* @param string $currency OPTIONAL Currency's short name
* @param string $locale OPTIONAL The locale
* @return string
*/
public function getName($currency = null, $locale = null);
/**
* Returns a list of regions where this currency is or was known
*
* @param string $currency OPTIONAL Currency's short name
* @throws CurrencyException When no currency was defined
* @return array List of regions
*/
public function getRegionList($currency = null);
/**
* Return currency list.
*
* Returns a list of currencies which are used in this region
* a region name should be 2 charachters only (f.e. EG, DE, US)
* If no region is given, the actual region is used
*
* @param string $region OPTIONAL Region to return the currencies for
* @return array List of currencies
*/
public function getCurrencyList($region = null);
/**
* Returns the actual currency name
*
* @return string
*/
public function toString();
/**
* Returns the set cache
*
* @return Zend_Cache_Core The set cache
*/
public static function getCache();
/**
* Sets a cache for \Magento\Framework\Currency
*
* @param Zend_Cache_Core $cache Cache to set
* @return void
*/
public static function setCache(Zend_Cache_Core $cache);
/**
* Returns true when a cache is set
*
* @return boolean
*/
public static function hasCache();
/**
* Removes any set cache
*
* @return void
*/
public static function removeCache();
/**
* Clears all set cache data
*
* @param string $tag Tag to clear when the default tag name is not used
* @return void
*/
public static function clearCache($tag = null);
/**
* Sets a new locale for data retrievement
* Example: 'de_XX' will be set to 'de' because 'de_XX' does not exist
* 'xx_YY' will be set to 'root' because 'xx' does not exist
*
* @param string $locale OPTIONAL Locale for parsing input
* @throws CurrencyException When the given locale does not exist
* @return $this
*/
public function setLocale($locale = null);
/**
* Returns the actual set locale
*
* @return string
*/
public function getLocale();
/**
* Returns the value
*
* @return float
*/
public function getValue();
/**
* Adds a currency
*
* @param float|int|CurrencyInterface $value Add this value to currency
* @param string|CurrencyInterface $currency The currency to add
* @return CurrencyInterface
* @deprecated This approach works incorrect, because Zend_Service no longer exists.
* @see no alternatives
*/
public function setValue($value, $currency = null);
/**
* Adds a currency
*
* @param float|int|CurrencyInterface $value Add this value to currency
* @param string|CurrencyInterface $currency The currency to add
* @return CurrencyInterface
* @deprecated This approach works incorrect, because Zend_Service no longer exists.
* @see no alternatives
*/
public function add($value, $currency = null);
/**
* Substracts a currency
*
* @param float|int|CurrencyInterface $value Substracts this value from currency
* @param string|CurrencyInterface $currency The currency to substract
* @return CurrencyInterface
* @deprecated This approach works incorrect, because Zend_Service no longer exists.
* @see no alternatives
*/
public function sub($value, $currency = null);
/**
* Divides a currency
*
* @param float|int|CurrencyInterface $value Divides this value from currency
* @param string|CurrencyInterface $currency The currency to divide
* @return CurrencyInterface
* @deprecated This approach works incorrect, because Zend_Service no longer exists.
* @see no alternatives
*/
public function div($value, $currency = null);
/**
* Multiplies a currency
*
* @param float|int|CurrencyInterface $value Multiplies this value from currency
* @param string|CurrencyInterface $currency The currency to multiply
* @return CurrencyInterface
* @deprecated This approach works incorrect, because Zend_Service no longer exists.
* @see no alternatives
*/
public function mul($value, $currency = null);
/**
* Calculates the modulo from a currency
*
* @param float|int|CurrencyInterface $value Calculate modulo from this value
* @param string|CurrencyInterface $currency The currency to calculate the modulo
* @return CurrencyInterface
* @deprecated This approach works incorrect, because Zend_Service no longer exists.
* @see no alternatives
*/
public function mod($value, $currency = null);
/**
* Compares two currencies
*
* @param float|int|CurrencyInterface $value Compares the currency with this value
* @param string|CurrencyInterface $currency The currency to compare this value from
* @return CurrencyInterface
* @deprecated This approach works incorrect, because Zend_Service no longer exists.
* @see no alternatives
*/
public function compare($value, $currency = null);
/**
* Returns true when the two currencies are equal
*
* @param float|int|CurrencyInterface $value Compares the currency with this value
* @param string|CurrencyInterface $currency The currency to compare this value from
* @return boolean
* @deprecated This approach works incorrect, because Zend_Service no longer exists.
* @see no alternatives
*/
public function equals($value, $currency = null);
/**
* Returns true when the currency is more than the given value
*
* @param float|int|CurrencyInterface $value Compares the currency with this value
* @param string|CurrencyInterface $currency The currency to compare this value from
* @return boolean
* @deprecated This approach works incorrect, because Zend_Service no longer exists.
* @see no alternatives
*/
public function isMore($value, $currency = null);
/**
* Returns true when the currency is less than the given value
*
* @param float|int|CurrencyInterface $value Compares the currency with this value
* @param string|CurrencyInterface $currency The currency to compare this value from
* @return boolean
* @deprecated This approach works incorrect, because Zend_Service no longer exists.
* @see no alternatives
*/
public function isLess($value, $currency = null);
}