diff --git a/src/Facades/VatValidatorFacade.php b/src/Facades/VatValidatorFacade.php index 03cf906..6b63983 100644 --- a/src/Facades/VatValidatorFacade.php +++ b/src/Facades/VatValidatorFacade.php @@ -5,6 +5,13 @@ use Danielebarbaro\LaravelVatEuValidator\VatValidator; use Illuminate\Support\Facades\Facade; +/** + * @method bool validateFormat(string $vatNumber) + * @method bool validateExistence(string $vatNumber) + * @method bool validate(string $vatNumber) + * @method static int luhnCheck(string $vatNumber) + * @method static string countryIsSupported(string $country) + */ class VatValidatorFacade extends Facade { /** diff --git a/src/VatValidator.php b/src/VatValidator.php index 7278870..3c13460 100644 --- a/src/VatValidator.php +++ b/src/VatValidator.php @@ -61,6 +61,15 @@ public function __construct(Client $client = null) } } + /** + * Return if a country is supported by this validator + * @param string $country + * @return bool + */ + public static function countryIsSupported(string $country): bool { + return isset(self::$pattern_expression[$country]); + } + /** * Validate a VAT number format. * @param string $vatNumber diff --git a/tests/Rules/CountryIsSupportedTest.php b/tests/Rules/CountryIsSupportedTest.php new file mode 100755 index 0000000..b598f35 --- /dev/null +++ b/tests/Rules/CountryIsSupportedTest.php @@ -0,0 +1,19 @@ +