Total Complexity | 3 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
8 | class ValidateUKMobileCommand extends BaseValidatorCommand |
||
9 | { |
||
10 | /** |
||
11 | * The name and signature of the console command. |
||
12 | * |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $signature = 'validate:uk-mobile |
||
16 | {source* : A list of numbers or files to validate against} |
||
17 | {--file : Specifies that the source is a list of files} |
||
18 | {--output= : Specifies that the output path}'; |
||
19 | |||
20 | /** |
||
21 | * The console command description. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $description = 'Validate UK mobile numbers and ouput to a CSV'; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $validCountryCodes = [ |
||
31 | 'GB', 'GG', 'JE', |
||
32 | ]; |
||
33 | |||
34 | /** |
||
35 | * Make a validator for a given number. |
||
36 | * |
||
37 | * @param mixed $number |
||
38 | * @return App\PhoneNumberValidator |
||
|
|||
39 | */ |
||
40 | 5 | public function makeValidatorForNumer($number): PhoneNumberValidator |
|
41 | { |
||
42 | 5 | return app(PhoneNumberValidator::class)->make($number, 'GB'); |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * Is the number valid? |
||
47 | * |
||
48 | * @param App\PhoneNumberValidator $validator |
||
49 | * @return bool |
||
50 | */ |
||
51 | 5 | public function isNumberValid(PhoneNumberValidator $validator): bool |
|
54 | } |
||
55 | } |
||
56 |