Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exceptions rates support #61

Closed
wants to merge 10 commits into from
3 changes: 2 additions & 1 deletion src/Countries.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ class Countries implements \Iterator, \ArrayAccess
'VI' => 'Virgin Islands, U.S.',
'WF' => 'Wallis And Futuna',
'EH' => 'Western Sahara',
'XI' => 'Northern Ireland',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Xi is not a valid IsoCode cf https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes

It's only used for VAT but it's not an isocode.

'YE' => 'Yemen',
'ZM' => 'Zambia',
'ZW' => 'Zimbabwe',
Expand All @@ -278,7 +279,7 @@ public function hasCountryCode(string $code) : bool
*/
public function isCountryCodeInEU(string $code) : bool
{
$eu = ['AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HU', 'HR', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK'];
$eu = ['AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GR', 'HU', 'HR', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK', 'XI'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, XI is not a valid isocode

return in_array($code, $eu);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class Validator
'ES' => '([A-Z]\d{7}[A-Z]|\d{8}[A-Z]|[A-Z]\d{8})',
'FI' => '\d{8}',
'FR' => '[A-Z\d]{2}\d{9}',
'GB' => '(\d{9}|\d{12}|(GD|HA)\d{3})',
'HR' => '\d{11}',
'HU' => '\d{8}',
'IE' => '([A-Z\d]{8}|[A-Z\d]{9})',
Expand All @@ -40,7 +39,8 @@ class Validator
'RO' => '\d{2,10}',
'SE' => '\d{12}',
'SI' => '\d{8}',
'SK' => '\d{10}'
'SK' => '\d{10}',
'XI' => '(\d{9}|\d{12}|(GD|HA)\d{3})',
];

/**
Expand Down