1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Kickbox Bundle. |
5
|
|
|
* |
6
|
|
|
* (c) Abdoul Ndiaye <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Andi\KickBoxBundle\Http; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* The response content of a Kickbox Request. |
16
|
|
|
* |
17
|
|
|
* @author Abdoul Ndiaye <[email protected]> |
18
|
|
|
*/ |
19
|
|
|
class Response |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* The remaining credit balance (Daily + On Demand). |
23
|
|
|
* |
24
|
|
|
* @var float |
25
|
|
|
*/ |
26
|
|
|
protected $balance; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* The elapsed time (in milliseconds) it took Kickbox to process the request. |
30
|
|
|
* |
31
|
|
|
* @var int |
32
|
|
|
*/ |
33
|
|
|
protected $responseTime; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* The verification result: deliverable, undeliverable, risky, unknown |
37
|
|
|
* |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
protected $result; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* The reason for the result. |
44
|
|
|
* |
45
|
|
|
* @var string |
46
|
|
|
*/ |
47
|
|
|
protected $reason; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* If the email address is a role address. |
51
|
|
|
* |
52
|
|
|
* @var boolean |
53
|
|
|
*/ |
54
|
|
|
protected $role; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* If the email address uses a free email service like gmail.com or yahoo.com. |
58
|
|
|
* |
59
|
|
|
* @var boolean |
60
|
|
|
*/ |
61
|
|
|
protected $free; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* If the email address uses a disposable domain like trashmail.com or mailinator.com. |
65
|
|
|
* |
66
|
|
|
* @var boolean |
67
|
|
|
*/ |
68
|
|
|
protected $disposable; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* If the email was accepted, but the domain appears to accept all emails addressed to that domain. |
72
|
|
|
* |
73
|
|
|
* @var boolean |
74
|
|
|
*/ |
75
|
|
|
protected $acceptAll; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @see did_you_mean <http://docs.kickbox.io/v2.0/docs/using-the-api> |
79
|
|
|
* |
80
|
|
|
* Returns a suggested email if a possible spelling error was detected. |
81
|
|
|
* |
82
|
|
|
* @var string|null |
83
|
|
|
*/ |
84
|
|
|
protected $suggestion; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* A quality score of the provided email address ranging between 0 (no quality) and 1 (perfect quality). |
88
|
|
|
* |
89
|
|
|
* @var float |
90
|
|
|
*/ |
91
|
|
|
protected $sendex; |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Returns a normalized version of the provided email address. |
95
|
|
|
* |
96
|
|
|
* @var string |
97
|
|
|
*/ |
98
|
|
|
protected $email; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* The user (a.k.a local part) of the provided email address. ([email protected] -> bob). |
102
|
|
|
* |
103
|
|
|
* @var string |
104
|
|
|
*/ |
105
|
|
|
protected $user; |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* The domain of the provided email address. |
109
|
|
|
* |
110
|
|
|
* @var string |
111
|
|
|
*/ |
112
|
|
|
protected $domain; |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* If the API request was successful. |
116
|
|
|
* |
117
|
|
|
* @var boolean |
118
|
|
|
*/ |
119
|
|
|
protected $success; |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* get Balance. |
123
|
|
|
* |
124
|
|
|
* @return float |
125
|
|
|
*/ |
126
|
1 |
|
public function getBalance() |
127
|
|
|
{ |
128
|
1 |
|
return $this->balance; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* Set Balance. |
133
|
|
|
* |
134
|
|
|
* @param float $balance |
135
|
|
|
* |
136
|
|
|
* @return $this |
137
|
|
|
*/ |
138
|
3 |
|
public function setBalance($balance) |
139
|
|
|
{ |
140
|
3 |
|
$this->balance = $balance; |
141
|
|
|
|
142
|
3 |
|
return $this; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* get ResponseTime. |
147
|
|
|
* |
148
|
|
|
* @return int |
149
|
|
|
*/ |
150
|
1 |
|
public function getResponseTime() |
151
|
|
|
{ |
152
|
1 |
|
return $this->responseTime; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* Set ResponseTime. |
157
|
|
|
* |
158
|
|
|
* @param int $responseTime |
159
|
|
|
* |
160
|
|
|
* @return $this |
161
|
|
|
*/ |
162
|
3 |
|
public function setResponseTime($responseTime) |
163
|
|
|
{ |
164
|
3 |
|
$this->responseTime = $responseTime; |
165
|
|
|
|
166
|
3 |
|
return $this; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* get Result. |
171
|
|
|
* |
172
|
|
|
* @return string |
173
|
|
|
*/ |
174
|
1 |
|
public function getResult() |
175
|
|
|
{ |
176
|
1 |
|
return $this->result; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* Set Result. |
181
|
|
|
* |
182
|
|
|
* @param string $result |
183
|
|
|
* |
184
|
|
|
* @return $this |
185
|
|
|
*/ |
186
|
2 |
|
public function setResult($result) |
187
|
|
|
{ |
188
|
2 |
|
$this->result = $result; |
189
|
|
|
|
190
|
2 |
|
return $this; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* get Reason. |
195
|
|
|
* |
196
|
|
|
* @return string |
197
|
|
|
*/ |
198
|
1 |
|
public function getReason() |
199
|
|
|
{ |
200
|
1 |
|
return $this->reason; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* Set Reason. |
205
|
|
|
* |
206
|
|
|
* @param string $reason |
207
|
|
|
* |
208
|
|
|
* @return $this |
209
|
|
|
*/ |
210
|
2 |
|
public function setReason($reason) |
211
|
|
|
{ |
212
|
2 |
|
$this->reason = $reason; |
213
|
|
|
|
214
|
2 |
|
return $this; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* is Role. |
219
|
|
|
* |
220
|
|
|
* @return boolean |
221
|
|
|
*/ |
222
|
1 |
|
public function isRole() |
223
|
|
|
{ |
224
|
1 |
|
return $this->role; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* Set Role. |
229
|
|
|
* |
230
|
|
|
* @param boolean $role |
231
|
|
|
* |
232
|
|
|
* @return $this |
233
|
|
|
*/ |
234
|
2 |
|
public function setRole($role) |
235
|
|
|
{ |
236
|
2 |
|
$this->role = $role; |
237
|
|
|
|
238
|
2 |
|
return $this; |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
/** |
242
|
|
|
* is Free. |
243
|
|
|
* |
244
|
|
|
* @return boolean |
245
|
|
|
*/ |
246
|
1 |
|
public function isFree() |
247
|
|
|
{ |
248
|
1 |
|
return $this->free; |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* Set Free. |
253
|
|
|
* |
254
|
|
|
* @param boolean $free |
255
|
|
|
* |
256
|
|
|
* @return $this |
257
|
|
|
*/ |
258
|
2 |
|
public function setFree($free) |
259
|
|
|
{ |
260
|
2 |
|
$this->free = $free; |
261
|
|
|
|
262
|
2 |
|
return $this; |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
/** |
266
|
|
|
* is Disposable. |
267
|
|
|
* |
268
|
|
|
* @return boolean |
269
|
|
|
*/ |
270
|
1 |
|
public function isDisposable() |
271
|
|
|
{ |
272
|
1 |
|
return $this->disposable; |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* Set Disposable. |
277
|
|
|
* |
278
|
|
|
* @param boolean $disposable |
279
|
|
|
* |
280
|
|
|
* @return $this |
281
|
|
|
*/ |
282
|
2 |
|
public function setDisposable($disposable) |
283
|
|
|
{ |
284
|
2 |
|
$this->disposable = $disposable; |
285
|
|
|
|
286
|
2 |
|
return $this; |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* is AcceptAll. |
291
|
|
|
* |
292
|
|
|
* @return boolean |
293
|
|
|
*/ |
294
|
1 |
|
public function isAcceptAll() |
295
|
|
|
{ |
296
|
1 |
|
return $this->acceptAll; |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* Set AcceptAll. |
301
|
|
|
* |
302
|
|
|
* @param boolean $acceptAll |
303
|
|
|
* |
304
|
|
|
* @return $this |
305
|
|
|
*/ |
306
|
2 |
|
public function setAcceptAll($acceptAll) |
307
|
|
|
{ |
308
|
2 |
|
$this->acceptAll = $acceptAll; |
309
|
|
|
|
310
|
2 |
|
return $this; |
311
|
|
|
} |
312
|
|
|
|
313
|
|
|
/** |
314
|
|
|
* get Suggestion. |
315
|
|
|
* |
316
|
|
|
* @return null|string |
317
|
|
|
*/ |
318
|
1 |
|
public function getSuggestion() |
319
|
|
|
{ |
320
|
1 |
|
return $this->suggestion; |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
/** |
324
|
|
|
* Set Suggestion. |
325
|
|
|
* |
326
|
|
|
* @param null|string $suggestion |
327
|
|
|
* |
328
|
|
|
* @return $this |
329
|
|
|
*/ |
330
|
2 |
|
public function setSuggestion($suggestion) |
331
|
|
|
{ |
332
|
2 |
|
$this->suggestion = $suggestion; |
333
|
|
|
|
334
|
2 |
|
return $this; |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
/** |
338
|
|
|
* get Sendex. |
339
|
|
|
* |
340
|
|
|
* @return float |
341
|
|
|
*/ |
342
|
1 |
|
public function getSendex() |
343
|
|
|
{ |
344
|
1 |
|
return $this->sendex; |
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* Set Sendex. |
349
|
|
|
* |
350
|
|
|
* @param float $sendex |
351
|
|
|
* |
352
|
|
|
* @return $this |
353
|
|
|
*/ |
354
|
2 |
|
public function setSendex($sendex) |
355
|
|
|
{ |
356
|
2 |
|
$this->sendex = $sendex; |
357
|
|
|
|
358
|
2 |
|
return $this; |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
/** |
362
|
|
|
* get Email. |
363
|
|
|
* |
364
|
|
|
* @return string |
365
|
|
|
*/ |
366
|
1 |
|
public function getEmail() |
367
|
|
|
{ |
368
|
1 |
|
return $this->email; |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
/** |
372
|
|
|
* Set Email. |
373
|
|
|
* |
374
|
|
|
* @param string $email |
375
|
|
|
* |
376
|
|
|
* @return $this |
377
|
|
|
*/ |
378
|
2 |
|
public function setEmail($email) |
379
|
|
|
{ |
380
|
2 |
|
$this->email = $email; |
381
|
|
|
|
382
|
2 |
|
return $this; |
383
|
|
|
} |
384
|
|
|
|
385
|
|
|
/** |
386
|
|
|
* get User. |
387
|
|
|
* |
388
|
|
|
* @return string |
389
|
|
|
*/ |
390
|
1 |
|
public function getUser() |
391
|
|
|
{ |
392
|
1 |
|
return $this->user; |
393
|
|
|
} |
394
|
|
|
|
395
|
|
|
/** |
396
|
|
|
* Set User. |
397
|
|
|
* |
398
|
|
|
* @param string $user |
399
|
|
|
* |
400
|
|
|
* @return $this |
401
|
|
|
*/ |
402
|
2 |
|
public function setUser($user) |
403
|
|
|
{ |
404
|
2 |
|
$this->user = $user; |
405
|
|
|
|
406
|
2 |
|
return $this; |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
/** |
410
|
|
|
* get Domain. |
411
|
|
|
* |
412
|
|
|
* @return string |
413
|
|
|
*/ |
414
|
1 |
|
public function getDomain() |
415
|
|
|
{ |
416
|
1 |
|
return $this->domain; |
417
|
|
|
} |
418
|
|
|
|
419
|
|
|
/** |
420
|
|
|
* Set Domain. |
421
|
|
|
* |
422
|
|
|
* @param string $domain |
423
|
|
|
* |
424
|
|
|
* @return $this |
425
|
|
|
*/ |
426
|
2 |
|
public function setDomain($domain) |
427
|
|
|
{ |
428
|
2 |
|
$this->domain = $domain; |
429
|
|
|
|
430
|
2 |
|
return $this; |
431
|
|
|
} |
432
|
|
|
|
433
|
|
|
/** |
434
|
|
|
* is Success. |
435
|
|
|
* |
436
|
|
|
* @return boolean |
437
|
|
|
*/ |
438
|
1 |
|
public function isSuccess() |
439
|
|
|
{ |
440
|
1 |
|
return $this->success; |
441
|
|
|
} |
442
|
|
|
|
443
|
|
|
/** |
444
|
|
|
* Set Success. |
445
|
|
|
* |
446
|
|
|
* @param boolean $success |
447
|
|
|
* |
448
|
|
|
* @return $this |
449
|
|
|
*/ |
450
|
2 |
|
public function setSuccess($success) |
451
|
|
|
{ |
452
|
2 |
|
$this->success = $success; |
453
|
|
|
|
454
|
2 |
|
return $this; |
455
|
|
|
} |
456
|
|
|
} |
457
|
|
|
|