1 | <?php |
||
6 | class Phone implements Rule |
||
7 | { |
||
8 | /** |
||
9 | * Determine if the validation rule passes. |
||
10 | * |
||
11 | * @param string $attribute |
||
12 | * @param mixed $value |
||
13 | * |
||
14 | * @return bool |
||
15 | */ |
||
16 | public function passes($attribute, $value) |
||
20 | |||
21 | /** |
||
22 | * Get the validation error message. |
||
23 | * |
||
24 | * @return string |
||
25 | */ |
||
26 | public function message() |
||
30 | |||
31 | /** |
||
32 | * Checks through all validation methods to verify it is in a |
||
33 | * phone number format of some type |
||
34 | * @param string $value The phone number to check |
||
35 | * @return boolean is it correct format? |
||
36 | */ |
||
37 | protected function isPhone($value) |
||
41 | |||
42 | /** |
||
43 | * Format example 5555555555, 15555555555 |
||
44 | * @param [type] $value [description] |
||
|
|||
45 | * @return boolean [description] |
||
46 | */ |
||
47 | protected function isDigits($value) |
||
55 | |||
56 | /** |
||
57 | * Format example +15555555555 |
||
58 | * @param string $value The phone number to check |
||
59 | * @return boolean is it correct format? |
||
60 | */ |
||
61 | protected function isE164($value) |
||
70 | |||
71 | /** |
||
72 | * Format examples: (555) 555-5555, 1 (555) 555-5555, 1-555-555-5555, 555-555-5555, 1 555 555-5555 |
||
73 | * https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers#United_States.2C_Canada.2C_and_other_NANP_countries |
||
74 | * @param string $value The phone number to check |
||
75 | * @return boolean is it correct format? |
||
76 | */ |
||
77 | protected function isNANP($value) |
||
83 | } |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.