1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ContactUs\Entity; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class ContactUs |
7
|
|
|
* |
8
|
|
|
* @package ContactUs\Entity |
9
|
|
|
* @author Djordje Stojiljkovic <[email protected]> |
10
|
|
|
*/ |
11
|
|
|
class ContactUs |
12
|
|
|
{ |
13
|
|
|
private $contact_uuid; |
14
|
|
|
private $contact_id; |
15
|
|
|
private $name; |
16
|
|
|
private $email; |
17
|
|
|
private $phone; |
18
|
|
|
private $subject; |
19
|
|
|
private $body; |
20
|
|
|
private $created_at; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @return mixed |
24
|
|
|
*/ |
25
|
|
|
public function getContactUuid() |
26
|
|
|
{ |
27
|
|
|
return $this->contact_id; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @param $uuid |
32
|
|
|
* |
33
|
|
|
* @return \ContactUs\Entity\ContactUs |
34
|
|
|
*/ |
35
|
|
|
public function setContactUuid($uuid) |
36
|
|
|
{ |
37
|
|
|
$this->contact_id = $uuid; |
38
|
|
|
return $this; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @return mixed |
43
|
|
|
*/ |
44
|
|
|
public function getContactId() |
45
|
|
|
{ |
46
|
|
|
return $this->contact_id; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param $id |
51
|
|
|
* |
52
|
|
|
* @return \ContactUs\Entity\ContactUs |
53
|
|
|
*/ |
54
|
|
|
public function setContactId($id) |
55
|
|
|
{ |
56
|
|
|
$this->contact_id = $id; |
57
|
|
|
return $this; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return string |
62
|
|
|
*/ |
63
|
|
|
public function getName() |
64
|
|
|
{ |
65
|
|
|
return $this->name; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param $name |
70
|
|
|
* |
71
|
|
|
* @return \ContactUs\Entity\ContactUs |
72
|
|
|
*/ |
73
|
|
|
public function setName($name) |
74
|
|
|
{ |
75
|
|
|
$this->name = $name; |
76
|
|
|
return $this; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @return string |
81
|
|
|
*/ |
82
|
|
|
public function getEmail() |
83
|
|
|
{ |
84
|
|
|
return $this->email; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @param $email |
89
|
|
|
* |
90
|
|
|
* @return \ContactUs\Entity\ContactUs |
91
|
|
|
*/ |
92
|
|
|
public function setEmail($email) |
93
|
|
|
{ |
94
|
|
|
$this->email = $email; |
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @return mixed |
100
|
|
|
*/ |
101
|
|
|
public function getPhone() |
102
|
|
|
{ |
103
|
|
|
return $this->phone; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @param $phone |
108
|
|
|
* |
109
|
|
|
* @return \ContactUs\Entity\ContactUs |
110
|
|
|
*/ |
111
|
|
|
public function setPhone($phone) |
112
|
|
|
{ |
113
|
|
|
$this->phone = $phone; |
114
|
|
|
return $this; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @return mixed |
119
|
|
|
*/ |
120
|
|
|
public function getSubject() |
121
|
|
|
{ |
122
|
|
|
return $this->subject; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @param $subject |
127
|
|
|
* |
128
|
|
|
* @return \ContactUs\Entity\ContactUs |
129
|
|
|
*/ |
130
|
|
|
public function setSubject($subject) |
131
|
|
|
{ |
132
|
|
|
$this->subject = $subject; |
133
|
|
|
return $this; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @return string |
138
|
|
|
*/ |
139
|
|
|
public function getBody() |
140
|
|
|
{ |
141
|
|
|
return $this->body; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @param $body |
146
|
|
|
* |
147
|
|
|
* @return \ContactUs\Entity\ContactUs |
148
|
|
|
*/ |
149
|
|
|
public function setBody($body) |
150
|
|
|
{ |
151
|
|
|
$this->body = $body; |
152
|
|
|
return $this; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return string |
157
|
|
|
*/ |
158
|
|
|
public function getCreatedAt() |
159
|
|
|
{ |
160
|
|
|
return $this->created_at; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @param string $createdAt |
165
|
|
|
* |
166
|
|
|
* @return \ContactUs\Entity\ContactUs |
167
|
|
|
*/ |
168
|
|
|
public function setCreatedAt($createdAt) |
169
|
|
|
{ |
170
|
|
|
$this->created_at = $createdAt; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* Hydration of object. |
175
|
|
|
* |
176
|
|
|
* @param array $data |
177
|
|
|
*/ |
178
|
|
View Code Duplication |
public function exchangeArray($data = []) |
|
|
|
|
179
|
|
|
{ |
180
|
|
|
// Fetch entity properties. |
181
|
|
|
$properties = array_keys( |
182
|
|
|
get_object_vars($this) |
183
|
|
|
); |
184
|
|
|
|
185
|
|
|
foreach ($properties as $property) { |
186
|
|
|
$this->{$property} = isset($data[$property]) ? $data[$property] : null; |
187
|
|
|
} |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* Dehydrate/Extract object to array. |
192
|
|
|
* |
193
|
|
|
* @return array |
194
|
|
|
*/ |
195
|
|
|
public function getArrayCopy() |
196
|
|
|
{ |
197
|
|
|
return [ |
198
|
|
|
'contact_uuid' => (binary) $this->contact_uuid, |
199
|
|
|
'contact_id' => (string) $this->contact_id, |
200
|
|
|
'name' => (string) $this->name, |
201
|
|
|
'email' => (string) $this->email, |
202
|
|
|
'phone' => $this->phone, |
203
|
|
|
'subject' => (string) $this->subject, |
204
|
|
|
'body' => (string) $this->body, |
205
|
|
|
'created_at' => (string) $this->created_at |
206
|
|
|
]; |
207
|
|
|
} |
208
|
|
|
} |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.