Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ibericode/vat
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Nov 30, 2023
2 parents 82bd431 + 2744069 commit 1e9d5ad
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
36 changes: 35 additions & 1 deletion src/Countries.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,41 @@ public function hasCountryCode(string $code): bool
*/
public function getCountryCodesInEU(): array
{
return ['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'];
return [
'AT', // Austria
'AX', // Aland islands => Finland
'BE', // Belgium
'BG', // Bulgaria
'CY', // Cyprus
'CZ', // Czechia
'DE', // Germany
'DK', // Denmark
'EE', // Estonia
'ES', // Spain
'FI', // Finland
'FR', // France
'GF', // French guiana => France
'GP', // Guadeloupe => France
'GR', // Greece
'HU', // Hungary
'HR', // Croatia
'IE', // Ireland
'IT', // Italy
'LT', // Lithuania
'LU', // Luxembourg
'LV', // Latvia
'MT', // Malta
'MQ', // Martinique => France
'NL', // Netherlands
'PL', // Poland
'PT', // Portugal
'RE', // Reunion => France
'RO', // Romania
'SE', // Sweden
'SI', // Slovenia
'SK', // Slovakia
'YT', // Mayotte => France
];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Validator
'GB' => '(\d{9}|\d{12}|(GD|HA)\d{3})',
'HR' => '\d{11}',
'HU' => '\d{8}',
'IE' => '([A-Z\d]{8}|[A-Z\d]{9})',
'IE' => '((\d{7}[A-Z]{1,2})|(\d[A-Z]\d{5}[A-Z]))',
'IT' => '\d{11}',
'LT' => '(\d{9}|\d{12})',
'LU' => '\d{8}',
Expand Down
5 changes: 5 additions & 0 deletions tests/ValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public function testValidateVatNumberFormat()
'HU12345678',
'HR12345678901',
'IE1234567X',
'IE1X34567X',
'IE1234567XX',
'IT12345678901',
'LT123456789',
'LU12345678',
Expand Down Expand Up @@ -78,6 +80,9 @@ public function testValidateVatNumberFormat()
'HU1234567',
'HR1234567890',
'IE123456X',
'IE1X34567XX',
'IE12345678X',
'IE123456789',
'IT1234567890',
'LT12345678',
'LU1234567',
Expand Down

0 comments on commit 1e9d5ad

Please sign in to comment.