|
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\Data\Entity\User; |
|
13
|
|
|
|
|
14
|
|
|
use DateTime; |
|
15
|
|
|
use WebHemi\Data\Entity\DataEntityInterface; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Class UserGroupEntity. |
|
19
|
|
|
*/ |
|
20
|
|
View Code Duplication |
class UserGroupEntity implements DataEntityInterface |
|
|
|
|
|
|
21
|
|
|
{ |
|
22
|
|
|
/** @var int */ |
|
23
|
|
|
private $userGroupId; |
|
24
|
|
|
/** @var string */ |
|
25
|
|
|
private $name; |
|
26
|
|
|
/** @var string */ |
|
27
|
|
|
private $title; |
|
28
|
|
|
/** @var string */ |
|
29
|
|
|
private $description; |
|
30
|
|
|
/** @var bool */ |
|
31
|
|
|
private $isReadOnly; |
|
32
|
|
|
/** @var DateTime */ |
|
33
|
|
|
private $dateCreated; |
|
34
|
|
|
/** @var DateTime */ |
|
35
|
|
|
private $dateModified; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Sets the value of the entity identifier. |
|
39
|
|
|
* |
|
40
|
|
|
* @param int $entityId |
|
41
|
|
|
* @return UserGroupEntity |
|
42
|
|
|
*/ |
|
43
|
1 |
|
public function setKeyData($entityId) |
|
44
|
|
|
{ |
|
45
|
1 |
|
$this->userGroupId = $entityId; |
|
46
|
|
|
|
|
47
|
1 |
|
return $this; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Gets the value of the entity identifier. |
|
52
|
|
|
* |
|
53
|
|
|
* @return int |
|
54
|
|
|
*/ |
|
55
|
2 |
|
public function getKeyData() |
|
56
|
|
|
{ |
|
57
|
2 |
|
return $this->userGroupId; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @param int $userGroupId |
|
62
|
|
|
* |
|
63
|
|
|
* @return UserGroupEntity |
|
64
|
|
|
*/ |
|
65
|
7 |
|
public function setUserGroupId($userGroupId) |
|
66
|
|
|
{ |
|
67
|
7 |
|
$this->userGroupId = $userGroupId; |
|
68
|
|
|
|
|
69
|
7 |
|
return $this; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @return int |
|
74
|
|
|
*/ |
|
75
|
3 |
|
public function getUserGroupId() |
|
76
|
|
|
{ |
|
77
|
3 |
|
return $this->userGroupId; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @param string $name |
|
82
|
|
|
* |
|
83
|
|
|
* @return UserGroupEntity |
|
84
|
|
|
*/ |
|
85
|
4 |
|
public function setName($name) |
|
86
|
|
|
{ |
|
87
|
4 |
|
$this->name = $name; |
|
88
|
|
|
|
|
89
|
4 |
|
return $this; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @return string |
|
94
|
|
|
*/ |
|
95
|
2 |
|
public function getName() |
|
96
|
|
|
{ |
|
97
|
2 |
|
return $this->name; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @param string $title |
|
102
|
|
|
* |
|
103
|
|
|
* @return UserGroupEntity |
|
104
|
|
|
*/ |
|
105
|
4 |
|
public function setTitle($title) |
|
106
|
|
|
{ |
|
107
|
4 |
|
$this->title = $title; |
|
108
|
|
|
|
|
109
|
4 |
|
return $this; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* @return string |
|
114
|
|
|
*/ |
|
115
|
3 |
|
public function getTitle() |
|
116
|
|
|
{ |
|
117
|
3 |
|
return $this->title; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* @param string $description |
|
122
|
|
|
* |
|
123
|
|
|
* @return UserGroupEntity |
|
124
|
|
|
*/ |
|
125
|
4 |
|
public function setDescription($description) |
|
126
|
|
|
{ |
|
127
|
4 |
|
$this->description = $description; |
|
128
|
|
|
|
|
129
|
4 |
|
return $this; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* @return string |
|
134
|
|
|
*/ |
|
135
|
3 |
|
public function getDescription() |
|
136
|
|
|
{ |
|
137
|
3 |
|
return $this->description; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* @param bool $state |
|
142
|
|
|
* |
|
143
|
|
|
* @return UserGroupEntity |
|
144
|
|
|
*/ |
|
145
|
4 |
|
public function setReadOnly($state) |
|
146
|
|
|
{ |
|
147
|
4 |
|
$this->isReadOnly = (bool) $state; |
|
148
|
|
|
|
|
149
|
4 |
|
return $this; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @return bool |
|
154
|
|
|
*/ |
|
155
|
3 |
|
public function getReadOnly() |
|
156
|
|
|
{ |
|
157
|
3 |
|
return $this->isReadOnly; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* @param DateTime $dateCreated |
|
162
|
|
|
* |
|
163
|
|
|
* @return UserGroupEntity |
|
164
|
|
|
*/ |
|
165
|
4 |
|
public function setDateCreated(DateTime $dateCreated) |
|
166
|
|
|
{ |
|
167
|
4 |
|
$this->dateCreated = $dateCreated; |
|
168
|
|
|
|
|
169
|
4 |
|
return $this; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
/** |
|
173
|
|
|
* @return DateTime |
|
174
|
|
|
*/ |
|
175
|
2 |
|
public function getDateCreated() |
|
176
|
|
|
{ |
|
177
|
2 |
|
return $this->dateCreated; |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
/** |
|
181
|
|
|
* @param DateTime $dateModified |
|
182
|
|
|
* |
|
183
|
|
|
* @return UserGroupEntity |
|
184
|
|
|
*/ |
|
185
|
4 |
|
public function setDateModified(DateTime $dateModified) |
|
186
|
|
|
{ |
|
187
|
4 |
|
$this->dateModified = $dateModified; |
|
188
|
|
|
|
|
189
|
4 |
|
return $this; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
/** |
|
193
|
|
|
* @return DateTime |
|
194
|
|
|
*/ |
|
195
|
2 |
|
public function getDateModified() |
|
196
|
|
|
{ |
|
197
|
2 |
|
return $this->dateModified; |
|
198
|
|
|
} |
|
199
|
|
|
} |
|
200
|
|
|
|
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.