-
Notifications
You must be signed in to change notification settings - Fork 3.6k
+1 VAT Provider w/ 40+ countries rules, fix #591 #594
Conversation
May fix #591 too |
* @link http://en.wikipedia.org/wiki/VAT_identification_number | ||
* @link https://github.com/ronanguilloux/IsoCodes/blob/master/src/IsoCodes/Vat.php | ||
*/ | ||
public static $patterns = array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
variable name is too generic IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true!
This supersedes the |
This generator looks similar to iban. Maybe a similar countries format can be used instead of regexps? |
*/ | ||
public static function vat($spacedNationalPrefix = true, $country = null) | ||
{ | ||
$country = is_null($country) ? array_rand(self::$countryPatterns) : $country; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
array_rand()
doesn't use the Mersenne Twister and therefore isn't seedable. Use Faker::randomElement()
instead.
Could I somehow help @ronanguilloux with this PR? I'd like to see it merged. |
Hi @nineinchnick, sure of course. I've been too busy lately to continue this PR, but feel free to fork my ronanguilloux:VAT-anyone branch and add your own contrib, and then re-PR to the main Faker repo right from your fork. No need to credit my part of it. |
Abandoned, closing. |
I had to handle backward compatibility on
vat
methodvat
methodI propose to tag them as
@deprecated
. Existing unit tests are maintained.