You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (! isset(self::VIES_EU_COUNTRY_LIST[$requesterCountryCode])) {
throw new ViesException(sprintf('Invalid requestor country code "%s" provided', $requesterCountryCode));
}
public static function listEuropeanCountries(): array
{
static $list;
if (! $list) {
$list = array_combine(
array_keys(self::VIES_EU_COUNTRY_LIST),
array_column(self::VIES_EU_COUNTRY_LIST, 'name')
);
unset($list['EU']);
}
return $list;
}
The IMO best way would be a new method isEuropeanCountry(string $countryIso) : bool.
And in this new method we should return
is set at VIES_EU_COUNTRY_LIST
and is NOT set at VIES_EXCLUDED_COUNTRY_CODES
As i saw you added a new const
VIES_EXCLUDED_COUNTRY_CODES
to exclude f.e. country isoGB
(currently in master, not in last release) .
This const should be used to exclude f.e.
GB
in thelistEuropeanCountries
method and other places.see https://github.com/DragonBe/vies/blob/master/src/Vies/Vies.php#L297
see https://github.com/DragonBe/vies/blob/master/src/Vies/Vies.php#L339
see https://github.com/DragonBe/vies/blob/master/src/Vies/Vies.php#L339
see https://github.com/DragonBe/vies/blob/master/src/Vies/Vies.php#L420
The IMO best way would be a new method
isEuropeanCountry(string $countryIso) : bool
.And in this new method we should return
is set at
VIES_EU_COUNTRY_LIST
and is NOT set at
VIES_EXCLUDED_COUNTRY_CODES
The exception thrown at https://github.com/DragonBe/vies/blob/master/src/Vies/Vies.php#L318
should be moved to https://github.com/DragonBe/vies/blob/master/src/Vies/Vies.php#L300
below the "Invalid country code" exception
to throw the "no longer supported" exception (which should actually be also say "invalid" IMO).
The text was updated successfully, but these errors were encountered: