|
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 string */ |
|
33
|
|
|
private $lastIp; |
|
34
|
|
|
/** @var string */ |
|
35
|
|
|
private $registerIp; |
|
36
|
|
|
/** @var bool */ |
|
37
|
|
|
private $isActive; |
|
38
|
|
|
/** @var bool */ |
|
39
|
|
|
private $isEnabled; |
|
40
|
|
|
/** @var DateTime */ |
|
41
|
|
|
private $timeLogin; |
|
42
|
|
|
/** @var DateTime */ |
|
43
|
|
|
private $timeRegister; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @param mixed $userId |
|
47
|
|
|
* |
|
48
|
|
|
* @return $this |
|
49
|
|
|
*/ |
|
50
|
4 |
|
public function setUserId($userId) |
|
51
|
|
|
{ |
|
52
|
4 |
|
$this->userId = $userId; |
|
53
|
|
|
|
|
54
|
4 |
|
return $this; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @return string |
|
59
|
|
|
*/ |
|
60
|
2 |
|
public function getUserId() |
|
61
|
|
|
{ |
|
62
|
2 |
|
return $this->userId; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @param string $userName |
|
67
|
|
|
* |
|
68
|
|
|
* @return $this |
|
69
|
|
|
*/ |
|
70
|
2 |
|
public function setUserName($userName) |
|
71
|
|
|
{ |
|
72
|
2 |
|
$this->userName = $userName; |
|
73
|
|
|
|
|
74
|
2 |
|
return $this; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* @return string |
|
79
|
|
|
*/ |
|
80
|
1 |
|
public function getUserName() |
|
81
|
|
|
{ |
|
82
|
1 |
|
return $this->userName; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* @param string $email |
|
87
|
|
|
* |
|
88
|
|
|
* @return $this |
|
89
|
|
|
*/ |
|
90
|
2 |
|
public function setEmail($email) |
|
91
|
|
|
{ |
|
92
|
2 |
|
$this->email = $email; |
|
93
|
|
|
|
|
94
|
2 |
|
return $this; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @return string |
|
99
|
|
|
*/ |
|
100
|
1 |
|
public function getEmail() |
|
101
|
|
|
{ |
|
102
|
1 |
|
return $this->email; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* @param string $password |
|
107
|
|
|
* |
|
108
|
|
|
* @return $this |
|
109
|
|
|
*/ |
|
110
|
2 |
|
public function setPassword($password) |
|
111
|
|
|
{ |
|
112
|
2 |
|
$this->password = $password; |
|
113
|
|
|
|
|
114
|
2 |
|
return $this; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* @return string |
|
119
|
|
|
*/ |
|
120
|
1 |
|
public function getPassword() |
|
121
|
|
|
{ |
|
122
|
1 |
|
return $this->password; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* @param string $hash |
|
127
|
|
|
* |
|
128
|
|
|
* @return $this |
|
129
|
|
|
*/ |
|
130
|
2 |
|
public function setHash($hash) |
|
131
|
|
|
{ |
|
132
|
2 |
|
$this->hash = $hash; |
|
133
|
|
|
|
|
134
|
2 |
|
return $this; |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
/** |
|
138
|
|
|
* @return string |
|
139
|
|
|
*/ |
|
140
|
1 |
|
public function getHash() |
|
141
|
|
|
{ |
|
142
|
1 |
|
return $this->hash; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* @param string $lastIp |
|
147
|
|
|
* |
|
148
|
|
|
* @return $this |
|
149
|
|
|
*/ |
|
150
|
2 |
|
public function setLastIp($lastIp) |
|
151
|
|
|
{ |
|
152
|
2 |
|
$this->lastIp = $lastIp; |
|
153
|
|
|
|
|
154
|
2 |
|
return $this; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
/** |
|
158
|
|
|
* @return string |
|
159
|
|
|
*/ |
|
160
|
1 |
|
public function getLastIp() |
|
161
|
|
|
{ |
|
162
|
1 |
|
return $this->lastIp; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* @param string $registerIp |
|
167
|
|
|
* |
|
168
|
|
|
* @return $this |
|
169
|
|
|
*/ |
|
170
|
2 |
|
public function setRegisterIp($registerIp) |
|
171
|
|
|
{ |
|
172
|
2 |
|
$this->registerIp = $registerIp; |
|
173
|
|
|
|
|
174
|
2 |
|
return $this; |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
/** |
|
178
|
|
|
* @return string |
|
179
|
|
|
*/ |
|
180
|
1 |
|
public function getRegisterIp() |
|
181
|
|
|
{ |
|
182
|
1 |
|
return $this->registerIp; |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* @param bool $state |
|
187
|
|
|
* |
|
188
|
|
|
* @return $this |
|
189
|
|
|
*/ |
|
190
|
6 |
|
public function setActive($state) |
|
191
|
|
|
{ |
|
192
|
6 |
|
$this->isActive = (bool) $state; |
|
193
|
|
|
|
|
194
|
6 |
|
return $this; |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
/** |
|
198
|
|
|
* @return bool |
|
199
|
|
|
*/ |
|
200
|
3 |
|
public function getActive() |
|
201
|
|
|
{ |
|
202
|
3 |
|
return $this->isActive; |
|
203
|
|
|
} |
|
204
|
|
|
|
|
205
|
|
|
/** |
|
206
|
|
|
* @param bool $state |
|
207
|
|
|
* |
|
208
|
|
|
* @return $this |
|
209
|
|
|
*/ |
|
210
|
6 |
|
public function setEnabled($state) |
|
211
|
|
|
{ |
|
212
|
6 |
|
$this->isEnabled = (bool) $state; |
|
213
|
|
|
|
|
214
|
6 |
|
return $this; |
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
|
|
/** |
|
218
|
|
|
* @return bool |
|
219
|
|
|
*/ |
|
220
|
3 |
|
public function getEnabled() |
|
221
|
|
|
{ |
|
222
|
3 |
|
return $this->isEnabled; |
|
223
|
|
|
} |
|
224
|
|
|
|
|
225
|
|
|
/** |
|
226
|
|
|
* @param DateTime $timeLogin |
|
227
|
|
|
* |
|
228
|
|
|
* @return $this |
|
229
|
|
|
*/ |
|
230
|
2 |
|
public function setTimeLogin(DateTime $timeLogin) |
|
231
|
|
|
{ |
|
232
|
2 |
|
$this->timeLogin = $timeLogin; |
|
233
|
|
|
|
|
234
|
2 |
|
return $this; |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
/** |
|
238
|
|
|
* @return DateTime |
|
239
|
|
|
*/ |
|
240
|
1 |
|
public function getTimeLogin() |
|
241
|
|
|
{ |
|
242
|
1 |
|
return $this->timeLogin; |
|
243
|
|
|
} |
|
244
|
|
|
|
|
245
|
|
|
/** |
|
246
|
|
|
* @param DateTime $timeRegister |
|
247
|
|
|
* |
|
248
|
|
|
* @return $this |
|
249
|
|
|
*/ |
|
250
|
2 |
|
public function setTimeRegister(DateTime $timeRegister) |
|
251
|
|
|
{ |
|
252
|
2 |
|
$this->timeRegister = $timeRegister; |
|
253
|
|
|
|
|
254
|
2 |
|
return $this; |
|
255
|
|
|
} |
|
256
|
|
|
|
|
257
|
|
|
/** |
|
258
|
|
|
* @return DateTime |
|
259
|
|
|
*/ |
|
260
|
1 |
|
public function getTimeRegister() |
|
261
|
|
|
{ |
|
262
|
1 |
|
return $this->timeRegister; |
|
263
|
|
|
} |
|
264
|
|
|
} |
|
265
|
|
|
|