1 | <?php |
||
9 | class EmailValidator |
||
10 | { |
||
11 | /** |
||
12 | * Various response messages based on verification status |
||
13 | * @var array |
||
14 | */ |
||
15 | public $serverResponses = [ |
||
16 | 'invalid_email' => 'Specified email has invalid email address syntax', |
||
17 | 'invalid_domain' => 'Domain name does not exist', |
||
18 | 'rejected_email' => 'SMTP server rejected email. Email does not exist', |
||
19 | 'accepted_email' => 'SMTP server accepted email address', |
||
20 | 'no_connect' => 'SMTP server connection failure', |
||
21 | 'timeout' => 'Session time out occurred at SMTP server', |
||
22 | 'unavailable_smtp' => 'SMTP server is not available to process request', |
||
23 | 'unexpected_error' => 'An unexpected error has occurred', |
||
24 | 'no_mx_record' => 'Could not get MX records for domain', |
||
25 | 'temporarily_blocked' => 'Email is temporarily greylisted', |
||
26 | 'exceeded_storage' => 'SMTP server rejected email. Exceeded storage allocation' |
||
27 | ]; |
||
28 | |||
29 | /** |
||
30 | * Api Key for quickemailverficationservice |
||
31 | * @var string |
||
32 | */ |
||
33 | public $apiKey; |
||
34 | |||
35 | /** |
||
36 | * Instance of QuickEmailVerification Client |
||
37 | * @var object |
||
38 | */ |
||
39 | public $client; |
||
40 | |||
41 | /** |
||
42 | * Response from the QuickEmailVerification Service |
||
43 | * @var object |
||
44 | */ |
||
45 | public $response; |
||
46 | |||
47 | public function __construct() |
||
52 | |||
53 | /** |
||
54 | * Get apiKey from Config file |
||
55 | * @return void |
||
56 | */ |
||
57 | public function setApikey() |
||
61 | |||
62 | /** |
||
63 | * Instantiate QuickEmailVerification Client with api Key |
||
64 | * @return void |
||
65 | */ |
||
66 | public function setClient() |
||
75 | |||
76 | /** |
||
77 | * Verifies email Address and returns an API Object response |
||
78 | * @param string $emailAddress |
||
79 | * @return instance |
||
80 | */ |
||
81 | public function verify($emailAddress) |
||
87 | |||
88 | /** |
||
89 | * Returns an array with true/false and an appropriate message when doing the email verification |
||
90 | * @return array |
||
91 | * @throws \InvalidArgumentException |
||
92 | */ |
||
93 | public function isValid() |
||
110 | |||
111 | /** |
||
112 | * Get the reason whether the email is valid, invalid or unknown |
||
113 | * @param string $reason |
||
114 | * @return string |
||
115 | */ |
||
116 | public function getReason($reason) |
||
120 | |||
121 | /** |
||
122 | * Returns true or false if the email address uses a disposable domain |
||
123 | * @return boolean |
||
124 | */ |
||
125 | public function isDisposable() |
||
129 | |||
130 | /** |
||
131 | * Returns true or false if the API request was successful |
||
132 | * @return boolean |
||
133 | */ |
||
134 | public function apiRequestStatus() |
||
138 | |||
139 | /** |
||
140 | * Get the domain of the provided email address |
||
141 | * @return string |
||
142 | */ |
||
143 | public function getDomainName() |
||
147 | |||
148 | /** |
||
149 | * Get the local part of an email address |
||
150 | * Example: [email protected] returns prosperotemuyiwa |
||
151 | * @return string |
||
152 | */ |
||
153 | public function getUser() |
||
157 | |||
158 | /** |
||
159 | * Gets a normalized version of the email address |
||
160 | * Example: [email protected] returns [email protected] |
||
161 | * @return string |
||
162 | */ |
||
163 | public function getEmailAddress() |
||
167 | |||
168 | /** |
||
169 | * Returns true if the domain appears to accept all emails delivered to that domain |
||
170 | * @return boolean |
||
171 | */ |
||
172 | public function acceptEmailsDeliveredToDomain() |
||
176 | |||
177 | /** |
||
178 | * Returns true or false if email address is a role address |
||
179 | * Example [email protected] , [email protected] will return true |
||
180 | * @return boolean |
||
181 | */ |
||
182 | public function isRole() |
||
186 | } |
||
187 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: