reducktion / socrates

PHP package to Validate and Extract information from National Identification Numbers.
MIT License
47 stars 4 forks source link

[v1.3.0] Create country constants #84

Closed AlexOlival closed 3 years ago

AlexOlival commented 3 years ago

As one can see in the Java port, it's much better to provide the user with whatever countries are supported rather than have them guess or research what countries can be used:

socrates.validateId('abcd', Country.PT);

As proud as I am of our exception handling for this case, we should create constants for each country and remove it.

e.g.:

$socrates->validateId('xpto', Country::PT);

or

$socrates->validateId('xpto', Country::PORTUGAL);