1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* WebHemi. |
4
|
|
|
* |
5
|
|
|
* PHP version 5.6 |
6
|
|
|
* |
7
|
|
|
* @copyright 2012 - 2016 Gixx-web (http://www.gixx-web.com) |
8
|
|
|
* @license https://opensource.org/licenses/MIT The MIT License (MIT) |
9
|
|
|
* |
10
|
|
|
* @link http://www.gixx-web.com |
11
|
|
|
*/ |
12
|
|
|
namespace WebHemi\DataEntity\User; |
13
|
|
|
|
14
|
|
|
use DateTime; |
15
|
|
|
use WebHemi\DataEntity\DataEntityInterface; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Class UserEntity. |
19
|
|
|
*/ |
20
|
|
|
class UserEntity implements DataEntityInterface |
21
|
|
|
{ |
22
|
|
|
/** @var string */ |
23
|
|
|
private $userId; |
24
|
|
|
/** @var string */ |
25
|
|
|
private $userName; |
26
|
|
|
/** @var string */ |
27
|
|
|
private $email; |
28
|
|
|
/** @var string */ |
29
|
|
|
private $password; |
30
|
|
|
/** @var string */ |
31
|
|
|
private $hash; |
32
|
|
|
/** @var bool */ |
33
|
|
|
private $isActive; |
34
|
|
|
/** @var bool */ |
35
|
|
|
private $isEnabled; |
36
|
|
|
/** @var DateTime */ |
37
|
|
|
private $dateCreated; |
38
|
|
|
/** @var DateTime */ |
39
|
|
|
private $dateModified; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param mixed $userId |
43
|
|
|
* |
44
|
|
|
* @return UserEntity |
45
|
|
|
*/ |
46
|
|
|
public function setUserId($userId) |
47
|
|
|
{ |
48
|
|
|
$this->userId = $userId; |
49
|
|
|
|
50
|
6 |
|
return $this; |
51
|
|
|
} |
52
|
6 |
|
|
53
|
|
|
/** |
54
|
6 |
|
* @return string |
55
|
|
|
*/ |
56
|
|
|
public function getUserId() |
57
|
|
|
{ |
58
|
|
|
return $this->userId; |
59
|
|
|
} |
60
|
2 |
|
|
61
|
|
|
/** |
62
|
2 |
|
* @param string $userName |
63
|
|
|
* |
64
|
|
|
* @return UserEntity |
65
|
|
|
*/ |
66
|
|
|
public function setUserName($userName) |
67
|
|
|
{ |
68
|
|
|
$this->userName = $userName; |
69
|
|
|
|
70
|
4 |
|
return $this; |
71
|
|
|
} |
72
|
4 |
|
|
73
|
|
|
/** |
74
|
4 |
|
* @return string |
75
|
|
|
*/ |
76
|
|
|
public function getUserName() |
77
|
|
|
{ |
78
|
|
|
return $this->userName; |
79
|
|
|
} |
80
|
1 |
|
|
81
|
|
|
/** |
82
|
1 |
|
* @param string $email |
83
|
|
|
* |
84
|
|
|
* @return UserEntity |
85
|
|
|
*/ |
86
|
|
|
public function setEmail($email) |
87
|
|
|
{ |
88
|
|
|
$this->email = $email; |
89
|
|
|
|
90
|
4 |
|
return $this; |
91
|
|
|
} |
92
|
4 |
|
|
93
|
|
|
/** |
94
|
4 |
|
* @return string |
95
|
|
|
*/ |
96
|
|
|
public function getEmail() |
97
|
|
|
{ |
98
|
|
|
return $this->email; |
99
|
|
|
} |
100
|
1 |
|
|
101
|
|
|
/** |
102
|
1 |
|
* @param string $password |
103
|
|
|
* |
104
|
|
|
* @return UserEntity |
105
|
|
|
*/ |
106
|
|
|
public function setPassword($password) |
107
|
|
|
{ |
108
|
|
|
$this->password = $password; |
109
|
|
|
|
110
|
4 |
|
return $this; |
111
|
|
|
} |
112
|
4 |
|
|
113
|
|
|
/** |
114
|
4 |
|
* @return string |
115
|
|
|
*/ |
116
|
|
|
public function getPassword() |
117
|
|
|
{ |
118
|
|
|
return $this->password; |
119
|
|
|
} |
120
|
3 |
|
|
121
|
|
|
/** |
122
|
3 |
|
* @param string $hash |
123
|
|
|
* |
124
|
|
|
* @return UserEntity |
125
|
|
|
*/ |
126
|
|
|
public function setHash($hash) |
127
|
|
|
{ |
128
|
|
|
$this->hash = $hash; |
129
|
|
|
|
130
|
4 |
|
return $this; |
131
|
|
|
} |
132
|
4 |
|
|
133
|
|
|
/** |
134
|
4 |
|
* @return string |
135
|
|
|
*/ |
136
|
|
|
public function getHash() |
137
|
|
|
{ |
138
|
|
|
return $this->hash; |
139
|
|
|
} |
140
|
1 |
|
|
141
|
|
|
/** |
142
|
1 |
|
* @param bool $state |
143
|
|
|
* |
144
|
|
|
* @return UserEntity |
145
|
|
|
*/ |
146
|
|
|
public function setActive($state) |
147
|
|
|
{ |
148
|
|
|
$this->isActive = (bool) $state; |
149
|
|
|
|
150
|
4 |
|
return $this; |
151
|
|
|
} |
152
|
4 |
|
|
153
|
|
|
/** |
154
|
4 |
|
* @return bool |
155
|
|
|
*/ |
156
|
|
|
public function getActive() |
157
|
|
|
{ |
158
|
|
|
return $this->isActive; |
159
|
|
|
} |
160
|
1 |
|
|
161
|
|
|
/** |
162
|
1 |
|
* @param bool $state |
163
|
|
|
* |
164
|
|
|
* @return UserEntity |
165
|
|
|
*/ |
166
|
|
|
public function setEnabled($state) |
167
|
|
|
{ |
168
|
|
|
$this->isEnabled = (bool) $state; |
169
|
|
|
|
170
|
4 |
|
return $this; |
171
|
|
|
} |
172
|
4 |
|
|
173
|
|
|
/** |
174
|
4 |
|
* @return bool |
175
|
|
|
*/ |
176
|
|
|
public function getEnabled() |
177
|
|
|
{ |
178
|
|
|
return $this->isEnabled; |
179
|
|
|
} |
180
|
1 |
|
|
181
|
|
|
/** |
182
|
1 |
|
* @param DateTime $dateCreated |
183
|
|
|
* |
184
|
|
|
* @return UserEntity |
185
|
|
|
*/ |
186
|
|
|
public function setDateCreated(DateTime $dateCreated) |
187
|
|
|
{ |
188
|
|
|
$this->dateCreated = $dateCreated; |
189
|
|
|
|
190
|
8 |
|
return $this; |
191
|
|
|
} |
192
|
8 |
|
|
193
|
|
|
/** |
194
|
8 |
|
* @return DateTime |
195
|
|
|
*/ |
196
|
|
|
public function getDateCreated() |
197
|
|
|
{ |
198
|
|
|
return $this->dateCreated; |
199
|
|
|
} |
200
|
3 |
|
|
201
|
|
|
/** |
202
|
3 |
|
* @param DateTime $dateModified |
203
|
|
|
* |
204
|
|
|
* @return UserEntity |
205
|
|
|
*/ |
206
|
|
|
public function setDateModified(DateTime $dateModified) |
207
|
|
|
{ |
208
|
|
|
$this->dateModified = $dateModified; |
209
|
|
|
|
210
|
8 |
|
return $this; |
211
|
|
|
} |
212
|
8 |
|
|
213
|
|
|
/** |
214
|
8 |
|
* @return DateTime |
215
|
|
|
*/ |
216
|
|
|
public function getDateModified() |
217
|
|
|
{ |
218
|
|
|
return $this->dateModified; |
219
|
|
|
} |
220
|
|
|
} |
221
|
|
|
|