1 | <?php |
||
17 | final class Domain |
||
18 | { |
||
19 | /** |
||
20 | * @var \DateTime |
||
21 | */ |
||
22 | private $createdAt; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $smtpLogin; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | private $name; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | private $smtpPassword; |
||
38 | |||
39 | /** |
||
40 | * @var bool |
||
41 | */ |
||
42 | private $wildcard; |
||
43 | |||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | private $spamAction; |
||
48 | |||
49 | /** |
||
50 | * @var string |
||
51 | */ |
||
52 | private $state; |
||
53 | |||
54 | /** |
||
55 | * @param array $data |
||
56 | * |
||
57 | * @return self |
||
58 | */ |
||
59 | public static function create(array $data) |
||
71 | |||
72 | /** |
||
73 | * @param string $name |
||
74 | * @param string $smtpLogin |
||
75 | * @param string $smtpPassword |
||
76 | * @param bool $wildcard |
||
77 | * @param string $spamAction |
||
78 | * @param string $state |
||
79 | * @param \DateTime $createdAt |
||
80 | */ |
||
81 | private function __construct($name, $smtpLogin, $smtpPassword, $wildcard, $spamAction, $state, \DateTime $createdAt) |
||
91 | |||
92 | /** |
||
93 | * @return string |
||
94 | */ |
||
95 | public function getName() |
||
99 | |||
100 | /** |
||
101 | * @return string |
||
102 | */ |
||
103 | public function getSmtpUsername() |
||
107 | |||
108 | /** |
||
109 | * @return string |
||
110 | */ |
||
111 | public function getSmtpPassword() |
||
115 | |||
116 | /** |
||
117 | * @return bool |
||
118 | */ |
||
119 | public function isWildcard() |
||
123 | |||
124 | /** |
||
125 | * @return string |
||
126 | */ |
||
127 | public function getSpamAction() |
||
131 | |||
132 | /** |
||
133 | * @return string |
||
134 | */ |
||
135 | public function getState() |
||
139 | |||
140 | /** |
||
141 | * @return \DateTime |
||
142 | */ |
||
143 | public function getCreatedAt() |
||
147 | } |
||
148 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: