1 | <?php |
||
13 | class MailboxCheckValidation implements EmailValidation |
||
14 | { |
||
15 | const END_OF_LINE = "\r\n"; |
||
16 | |||
17 | /** |
||
18 | * @var InvalidEmail |
||
19 | */ |
||
20 | private $error; |
||
21 | |||
22 | /** |
||
23 | * @var Warning[] |
||
24 | */ |
||
25 | private $warnings = []; |
||
26 | |||
27 | /** |
||
28 | * @var SmtpSocketHelper |
||
29 | */ |
||
30 | private $socketHelper; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $fromEmail; |
||
36 | |||
37 | /** |
||
38 | * @var int |
||
39 | */ |
||
40 | private $lastResponseCode; |
||
41 | |||
42 | /** |
||
43 | * MailboxCheckValidation constructor. |
||
44 | * |
||
45 | * @param SmtpSocketHelper $socketHelper |
||
46 | * @param string $fromEmail |
||
47 | */ |
||
48 | 3 | public function __construct(SmtpSocketHelper $socketHelper, $fromEmail) |
|
57 | |||
58 | /** |
||
59 | * @inheritDoc |
||
60 | */ |
||
61 | 1 | public function getError() |
|
65 | |||
66 | /** |
||
67 | * @inheritDoc |
||
68 | */ |
||
69 | 1 | public function getWarnings() |
|
73 | |||
74 | /** |
||
75 | * @inheritDoc |
||
76 | */ |
||
77 | 3 | public function isValid($email, EmailLexer $emailLexer) |
|
95 | |||
96 | /** |
||
97 | * Gets MX Hosts from email |
||
98 | * |
||
99 | * @param string $email |
||
100 | * |
||
101 | * @return array |
||
102 | */ |
||
103 | 3 | protected function getMXHosts($email) |
|
114 | |||
115 | /** |
||
116 | * Extracts hostname from email |
||
117 | * |
||
118 | * @param string $email |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | 3 | private function extractHostname($email) |
|
134 | |||
135 | /** |
||
136 | * Checks mailbox |
||
137 | * |
||
138 | * @param string $hostname |
||
139 | * @param string $email |
||
140 | * @return bool |
||
141 | */ |
||
142 | 2 | private function checkMailboxExists($hostname, $email) |
|
181 | } |