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