@@ -41,7 +41,7 @@ |
||
41 | 41 | return true; |
42 | 42 | } |
43 | 43 | |
44 | - public function getStructuralTemplate(?CountryInterface $country=null): string |
|
44 | + public function getStructuralTemplate(?CountryInterface $country = null): string |
|
45 | 45 | { |
46 | 46 | return '{symbol} -{amount}'; |
47 | 47 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | return self::ISO_CODE; |
16 | 16 | } |
17 | 17 | |
18 | - public function getStructuralTemplate(?CountryInterface $country=null): string |
|
18 | + public function getStructuralTemplate(?CountryInterface $country = null): string |
|
19 | 19 | { |
20 | 20 | return '{symbol} -{amount}'; |
21 | 21 | } |
@@ -36,9 +36,9 @@ |
||
36 | 36 | return false; |
37 | 37 | } |
38 | 38 | |
39 | - public function getStructuralTemplate(?CountryInterface $country=null): string |
|
39 | + public function getStructuralTemplate(?CountryInterface $country = null): string |
|
40 | 40 | { |
41 | - if($country instanceof Localization_Country_FR) { |
|
41 | + if ($country instanceof Localization_Country_FR) { |
|
42 | 42 | return '- {amount} {symbol}'; |
43 | 43 | } |
44 | 44 |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | */ |
34 | 34 | protected $country; |
35 | 35 | |
36 | - /** |
|
37 | - * @var string |
|
38 | - */ |
|
36 | + /** |
|
37 | + * @var string |
|
38 | + */ |
|
39 | 39 | protected $countryCode; |
40 | 40 | |
41 | - /** |
|
42 | - * @var string |
|
43 | - */ |
|
41 | + /** |
|
42 | + * @var string |
|
43 | + */ |
|
44 | 44 | protected $languageCode; |
45 | 45 | |
46 | 46 | public function __construct() |
@@ -64,25 +64,25 @@ discard block |
||
64 | 64 | return Localization::isLocaleSupported($localeName); |
65 | 65 | } |
66 | 66 | |
67 | - /** |
|
68 | - * Retrieves the shortened version of the locale name, |
|
69 | - * e.g. "en" or "de". |
|
70 | - * |
|
71 | - * @return string |
|
72 | - * @deprecated |
|
73 | - * @see Localization_Locale::getLanguageCode() |
|
74 | - */ |
|
67 | + /** |
|
68 | + * Retrieves the shortened version of the locale name, |
|
69 | + * e.g. "en" or "de". |
|
70 | + * |
|
71 | + * @return string |
|
72 | + * @deprecated |
|
73 | + * @see Localization_Locale::getLanguageCode() |
|
74 | + */ |
|
75 | 75 | public function getShortName() : string |
76 | 76 | { |
77 | 77 | return $this->getLanguageCode(); |
78 | 78 | } |
79 | 79 | |
80 | - /** |
|
81 | - * Retrieves the two-letter country code of |
|
82 | - * the locale. |
|
83 | - * |
|
84 | - * @return string Lowercase code, e.g. "uk" |
|
85 | - */ |
|
80 | + /** |
|
81 | + * Retrieves the two-letter country code of |
|
82 | + * the locale. |
|
83 | + * |
|
84 | + * @return string Lowercase code, e.g. "uk" |
|
85 | + */ |
|
86 | 86 | public function getCountryCode() : string |
87 | 87 | { |
88 | 88 | return $this->countryCode; |
@@ -102,7 +102,7 @@ |
||
102 | 102 | |
103 | 103 | public function getCountry() : BaseCountry |
104 | 104 | { |
105 | - if(!isset($this->country)) { |
|
105 | + if (!isset($this->country)) { |
|
106 | 106 | $this->country = Localization::createCountries()->getByID($this->getCountryCode()); |
107 | 107 | } |
108 | 108 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | public function getCurrency() : CountryCurrency |
26 | 26 | { |
27 | - if(!isset($this->currency)) { |
|
27 | + if (!isset($this->currency)) { |
|
28 | 28 | $this->currency = new CountryCurrency( |
29 | 29 | Localization::createCurrencies()->getByID($this->getCurrencyISO()), |
30 | 30 | $this |
@@ -75,7 +75,7 @@ |
||
75 | 75 | |
76 | 76 | public function choose() : CannedCountries |
77 | 77 | { |
78 | - if(!isset($this->canned)) { |
|
78 | + if (!isset($this->canned)) { |
|
79 | 79 | $this->canned = new CannedCountries(); |
80 | 80 | } |
81 | 81 |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | return $this->currency->isNamePreferred(); |
68 | 68 | } |
69 | 69 | |
70 | - public function getStructuralTemplate(?CountryInterface $country=null): string |
|
70 | + public function getStructuralTemplate(?CountryInterface $country = null): string |
|
71 | 71 | { |
72 | 72 | return $this->currency->getStructuralTemplate($this->country); |
73 | 73 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | return true; |
85 | 85 | } |
86 | 86 | |
87 | - return preg_match($this->getRegex(), (string)$number) !== false; |
|
87 | + return preg_match($this->getRegex(), (string) $number) !== false; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | protected $regex = '/\A([0-9%1$s]+)\z|([0-9%1$s]+),-\z|([0-9%1$s]+)[%2$s]([0-9]+)\z/s'; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $thousands = implode('', $parts); |
187 | 187 | } |
188 | 188 | |
189 | - return new CurrencyNumberInfo((int)$thousands, (int)$decimals); |
|
189 | + return new CurrencyNumberInfo((int) $thousands, (int) $decimals); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -195,17 +195,17 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function normalizeNumber($number) : string |
197 | 197 | { |
198 | - if($number === '' || $number === null) { |
|
198 | + if ($number === '' || $number === null) { |
|
199 | 199 | return ''; |
200 | 200 | } |
201 | 201 | |
202 | - $normalized = str_replace(' ', '', (string)$number); |
|
202 | + $normalized = str_replace(' ', '', (string) $number); |
|
203 | 203 | $dSep = $this->getDecimalsSeparator(); |
204 | 204 | $tSep = $this->getThousandsSeparator(); |
205 | 205 | |
206 | 206 | // Handle the case where both classical separators are used, |
207 | 207 | // independently of the country's specific separators. |
208 | - if(strpos($normalized, '.') !== false && strpos($normalized, ',') !== false) { |
|
208 | + if (strpos($normalized, '.') !== false && strpos($normalized, ',') !== false) { |
|
209 | 209 | $normalized = str_replace(array('.', ','), '.', $normalized); |
210 | 210 | $parts = explode('.', $normalized); |
211 | 211 | $decimals = array_pop($parts); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | public function formatNumber($number, int $decimalPositions = 2) : string |
246 | 246 | { |
247 | 247 | return number_format( |
248 | - (float)$number, |
|
248 | + (float) $number, |
|
249 | 249 | $decimalPositions, |
250 | 250 | $this->getDecimalsSeparator(), |
251 | 251 | $this->getThousandsSeparator() |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | return $this->country->getNumberDecimalsSeparator(); |
263 | 263 | } |
264 | 264 | |
265 | - public function makeReadable($number, int $decimalPositions = 2, bool $addSymbol=true) : string |
|
265 | + public function makeReadable($number, int $decimalPositions = 2, bool $addSymbol = true) : string |
|
266 | 266 | { |
267 | 267 | if ($number === null || $number === '') { |
268 | 268 | return ''; |
@@ -275,12 +275,12 @@ discard block |
||
275 | 275 | $decimalPositions |
276 | 276 | ); |
277 | 277 | |
278 | - if(!$addSymbol) { |
|
278 | + if (!$addSymbol) { |
|
279 | 279 | return $number; |
280 | 280 | } |
281 | 281 | |
282 | 282 | $sign = ''; |
283 | - if($parsed->isNegative()) { |
|
283 | + if ($parsed->isNegative()) { |
|
284 | 284 | $sign = '-'; |
285 | 285 | } |
286 | 286 | |
@@ -299,6 +299,6 @@ discard block |
||
299 | 299 | |
300 | 300 | public function __toString() |
301 | 301 | { |
302 | - return (string)$this->currency; |
|
302 | + return (string) $this->currency; |
|
303 | 303 | } |
304 | 304 | } |
@@ -179,8 +179,7 @@ |
||
179 | 179 | if ($decimals === '-') { |
180 | 180 | $decimals = 0; |
181 | 181 | } |
182 | - } |
|
183 | - else |
|
182 | + } else |
|
184 | 183 | { |
185 | 184 | $decimals = 0; |
186 | 185 | $thousands = implode('', $parts); |
@@ -64,7 +64,7 @@ |
||
64 | 64 | |
65 | 65 | public function choose() : CannedCurrencies |
66 | 66 | { |
67 | - if(!isset($this->canned)) { |
|
67 | + if (!isset($this->canned)) { |
|
68 | 68 | $this->canned = new CannedCurrencies(); |
69 | 69 | } |
70 | 70 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function getFloat() : float |
52 | 52 | { |
53 | - return (float)($this->getString()); |
|
53 | + return (float) ($this->getString()); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | return 0; |
82 | 82 | } |
83 | 83 | |
84 | - return strlen((string)$this->decimals); |
|
84 | + return strlen((string) $this->decimals); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | public function getString() : string |
88 | 88 | { |
89 | - return $this->number . '.' . $this->decimals; |
|
89 | + return $this->number.'.'.$this->decimals; |
|
90 | 90 | } |
91 | 91 | } |