-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Inn mask #1986
base: next
Are you sure you want to change the base?
Inn mask #1986
Conversation
Codecov Report
@@ Coverage Diff @@
## next #1986 +/- ##
============================================
+ Coverage 70.21% 70.55% +0.34%
- Complexity 1600 1610 +10
============================================
Files 287 287
Lines 3864 3885 +21
============================================
+ Hits 2713 2741 +28
+ Misses 1151 1144 -7
Continue to review full report at Codecov.
|
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.
Mask as param can be used for generate incorrect INN codes. Better is use type off INN
src/Faker/Provider/ru_RU/Company.php
Outdated
@@ -96,7 +96,7 @@ public static function companyNameSuffix() | |||
return static::randomElement(static::$companyNameSuffixes); | |||
} | |||
|
|||
public static function inn($area_code = "") | |||
public static function inn($area_code = "", $mask = '#######') |
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.
Use mask as parameter is not good idea. I think better is use type of INN: for Person (12 digits) or Company (10 digits)
And then use type inside method for generate mask.
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.
Or move INN generator to common function in \Faker\Calculator\Inn and add inn to Person.php too
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.
Or move INN generator to common function in \Faker\Calculator\Inn and add inn to Person.php too
Thank you for your comments. Using Inn base class and divide the INN for the company and person will be more object-oriented way.
src/Faker/Calculator/Inn.php
Outdated
@@ -15,8 +15,11 @@ class Inn | |||
public static function checksum($inn) |
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.
There is possible add INN type (Person or Company) and then use it in cases inside method
Now you can use 12 digits of the Inn.