1 | <?php |
||
11 | class EmailValidator |
||
12 | { |
||
13 | const ERR_DEPREC_REACHED = 151; |
||
14 | |||
15 | /** |
||
16 | * @var EmailLexer |
||
17 | */ |
||
18 | private $lexer; |
||
19 | protected $warnings; |
||
20 | protected $error; |
||
21 | protected $threshold = 255; |
||
22 | |||
23 | public function __construct() |
||
27 | |||
28 | /** |
||
29 | * @param $email |
||
30 | * @param EmailValidation $emailValidation |
||
31 | * @return bool |
||
32 | */ |
||
33 | public function isValid($email, EmailValidation $emailValidation) |
||
47 | |||
48 | /** |
||
49 | * @return boolean |
||
50 | */ |
||
51 | public function hasWarnings() |
||
55 | |||
56 | /** |
||
57 | * @return array |
||
58 | */ |
||
59 | public function getWarnings() |
||
63 | |||
64 | /** |
||
65 | * @return string |
||
66 | */ |
||
67 | public function getError() |
||
71 | |||
72 | protected function checkDNS() |
||
88 | |||
89 | protected function addTLDWarnings() |
||
98 | } |
||
99 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: