@@ -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 | |
@@ -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 | } |
@@ -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 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | * Add the country to guarantee the matching formatting, otherwise the default formatting is returned. |
| 53 | 53 | * @return string |
| 54 | 54 | */ |
| 55 | - public function getStructuralTemplate(?CountryInterface $country=null) : string; |
|
| 55 | + public function getStructuralTemplate(?CountryInterface $country = null) : string; |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * Whether the symbol is typically shown at the beginning of the amount. |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | $countries = array(); |
| 51 | 51 | $iso = $this->getISO(); |
| 52 | 52 | |
| 53 | - foreach(Localization::createCountries()->getAll() as $country) { |
|
| 54 | - if($country->getCurrencyISO() === $iso) { |
|
| 53 | + foreach (Localization::createCountries()->getAll() as $country) { |
|
| 54 | + if ($country->getCurrencyISO() === $iso) { |
|
| 55 | 55 | $countries[] = $country; |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | public function getPreferredSymbol(): string |
| 86 | 86 | { |
| 87 | - if($this->isNamePreferred()) { |
|
| 87 | + if ($this->isNamePreferred()) { |
|
| 88 | 88 | return $this->getISO(); |
| 89 | 89 | } |
| 90 | 90 | |