1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* Copyright (C) 2013 Mailgun |
7
|
|
|
* |
8
|
|
|
* This software may be modified and distributed under the terms |
9
|
|
|
* of the MIT license. See the LICENSE file for details. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Mailgun\Model\EmailValidationV4; |
13
|
|
|
|
14
|
|
|
use Mailgun\Model\ApiResponse; |
15
|
|
|
|
16
|
|
|
final class ValidateResponse implements ApiResponse |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @var string|null |
20
|
|
|
*/ |
21
|
|
|
private $address; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var string|null |
25
|
|
|
*/ |
26
|
|
|
private $didYouMean; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var bool |
30
|
|
|
*/ |
31
|
|
|
private $isDisposableAddress = false; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var bool |
35
|
|
|
*/ |
36
|
|
|
private $isRoleAddress = false; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var array |
40
|
|
|
*/ |
41
|
|
|
private $reason = []; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var string|null |
45
|
|
|
*/ |
46
|
|
|
private $result; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var string|null |
50
|
|
|
*/ |
51
|
|
|
private $risk; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var string|null |
55
|
|
|
*/ |
56
|
|
|
private $rootAddress; |
57
|
|
|
|
58
|
2 |
|
private function __construct() |
59
|
|
|
{ |
60
|
2 |
|
} |
61
|
|
|
|
62
|
2 |
|
public static function create(array $data): self |
63
|
|
|
{ |
64
|
2 |
|
$model = new self(); |
65
|
2 |
|
$model->address = $data['address'] ?? null; |
66
|
2 |
|
$model->didYouMean = $data['did_you_mean'] ?? null; |
67
|
2 |
|
$model->isDisposableAddress = $data['is_disposable_address'] ?? false; |
68
|
2 |
|
$model->isRoleAddress = $data['is_role_address'] ?? false; |
69
|
2 |
|
$model->reason = $data['reason'] ?? []; |
70
|
2 |
|
$model->result = $data['result'] ?? null; |
71
|
2 |
|
$model->risk = $data['risk'] ?? null; |
72
|
2 |
|
$model->rootAddress = $data['root_address'] ?? null; |
73
|
|
|
|
74
|
2 |
|
return $model; |
75
|
|
|
} |
76
|
|
|
|
77
|
2 |
|
public function getAddress(): ?string |
78
|
|
|
{ |
79
|
2 |
|
return $this->address; |
80
|
|
|
} |
81
|
|
|
|
82
|
2 |
|
public function getDidYouMean(): ?string |
83
|
|
|
{ |
84
|
2 |
|
return $this->didYouMean; |
85
|
|
|
} |
86
|
|
|
|
87
|
2 |
|
public function isDisposableAddress(): bool |
88
|
|
|
{ |
89
|
2 |
|
return $this->isDisposableAddress; |
90
|
|
|
} |
91
|
|
|
|
92
|
2 |
|
public function isRoleAddress(): bool |
93
|
|
|
{ |
94
|
2 |
|
return $this->isRoleAddress; |
95
|
|
|
} |
96
|
|
|
|
97
|
2 |
|
public function getReason(): array |
98
|
|
|
{ |
99
|
2 |
|
return $this->reason; |
100
|
|
|
} |
101
|
|
|
|
102
|
2 |
|
public function getResult(): ?string |
103
|
|
|
{ |
104
|
2 |
|
return $this->result; |
105
|
|
|
} |
106
|
|
|
|
107
|
2 |
|
public function getRisk(): ?string |
108
|
|
|
{ |
109
|
2 |
|
return $this->risk; |
110
|
|
|
} |
111
|
|
|
|
112
|
2 |
|
public function getRootAddress(): ?string |
113
|
|
|
{ |
114
|
2 |
|
return $this->rootAddress; |
115
|
|
|
} |
116
|
|
|
} |
117
|
|
|
|