Passed
Push — master ( 97f73d...f32c79 )
by Gabor
08:10
created

UserEntity::getPassword()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * WebHemi.
4
 *
5
 * PHP version 7.1
6
 *
7
 * @copyright 2012 - 2017 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
declare(strict_types = 1);
13
14
namespace WebHemi\Data\Entity\User;
15
16
use WebHemi\DateTime;
17
use WebHemi\Data\Entity\DataEntityInterface;
18
19
/**
20
 * Class UserEntity.
21
 */
22
class UserEntity implements DataEntityInterface
23
{
24
    /** @var int */
25
    private $userId;
26
    /** @var string */
27
    private $userName;
28
    /** @var string */
29
    private $email;
30
    /** @var string */
31
    private $password;
32
    /** @var string */
33
    private $hash;
34
    /** @var bool */
35
    private $isActive;
36
    /** @var bool */
37
    private $isEnabled;
38
    /** @var DateTime */
39
    private $dateCreated;
40
    /** @var DateTime */
41
    private $dateModified;
42
43
    /**
44
     * Sets the value of the entity identifier.
45
     *
46
     * @param int $entityId
47
     * @return UserEntity
48
     */
49 2
    public function setKeyData(int $entityId) : UserEntity
50
    {
51 2
        $this->userId = $entityId;
52
53 2
        return $this;
54
    }
55
56
    /**
57
     * Gets the value of the entity identifier.
58
     *
59
     * @return null|int
60
     */
61 4
    public function getKeyData() : ? int
62
    {
63 4
        return $this->userId;
64
    }
65
66
    /**
67
     * @param int $userId
68
     * @return UserEntity
69
     */
70 7
    public function setUserId(int $userId) : UserEntity
71
    {
72 7
        $this->userId = $userId;
73
74 7
        return $this;
75
    }
76
77
    /**
78
     * @return null|int
79
     */
80 2
    public function getUserId() : ? int
81
    {
82 2
        return $this->userId;
83
    }
84
85
    /**
86
     * @param string $userName
87
     * @return UserEntity
88
     */
89 8
    public function setUserName(string $userName) : UserEntity
90
    {
91 8
        $this->userName = $userName;
92
93 8
        return $this;
94
    }
95
96
    /**
97
     * @return null|string
98
     */
99 6
    public function getUserName() : ? string
100
    {
101 6
        return $this->userName;
102
    }
103
104
    /**
105
     * @param string $email
106
     * @return UserEntity
107
     */
108 7
    public function setEmail(string $email) : UserEntity
109
    {
110 7
        $this->email = $email;
111
112 7
        return $this;
113
    }
114
115
    /**
116
     * @return null|string
117
     */
118 5
    public function getEmail() : ? string
119
    {
120 5
        return $this->email;
121
    }
122
123
    /**
124
     * @param string $password
125
     * @return UserEntity
126
     */
127 6
    public function setPassword(string $password) : UserEntity
128
    {
129 6
        $this->password = $password;
130
131 6
        return $this;
132
    }
133
134
    /**
135
     * @return null|string
136
     */
137 5
    public function getPassword() : ? string
138
    {
139 5
        return $this->password;
140
    }
141
142
    /**
143
     * @param string $hash
144
     * @return UserEntity
145
     */
146 6
    public function setHash(string $hash) : UserEntity
147
    {
148 6
        $this->hash = $hash;
149
150 6
        return $this;
151
    }
152
153
    /**
154
     * @return null|string
155
     */
156 4
    public function getHash() : ? string
157
    {
158 4
        return $this->hash;
159
    }
160
161
    /**
162
     * @param bool $state
163
     * @return UserEntity
164
     */
165 6
    public function setActive(bool $state) : UserEntity
166
    {
167 6
        $this->isActive = $state;
168
169 6
        return $this;
170
    }
171
172
    /**
173
     * @return bool
174
     */
175 4
    public function getActive() : bool
176
    {
177 4
        return $this->isActive ?? false;
178
    }
179
180
    /**
181
     * @param bool $state
182
     * @return UserEntity
183
     */
184 6
    public function setEnabled(bool $state) : UserEntity
185
    {
186 6
        $this->isEnabled = $state;
187
188 6
        return $this;
189
    }
190
191
    /**
192
     * @return bool
193
     */
194 5
    public function getEnabled() : bool
195
    {
196 5
        return $this->isEnabled ?? false;
197
    }
198
199
    /**
200
     * @param DateTime $dateCreated
201
     * @return UserEntity
202
     */
203 6
    public function setDateCreated(DateTime $dateCreated) : UserEntity
204
    {
205 6
        $this->dateCreated = $dateCreated;
206
207 6
        return $this;
208
    }
209
210
    /**
211
     * @return null|DateTime
212
     */
213 5
    public function getDateCreated() : ? DateTime
214
    {
215 5
        return $this->dateCreated;
216
    }
217
218
    /**
219
     * @param DateTime $dateModified
220
     * @return UserEntity
221
     */
222 6
    public function setDateModified(DateTime $dateModified) : UserEntity
223
    {
224 6
        $this->dateModified = $dateModified;
225
226 6
        return $this;
227
    }
228
229
    /**
230
     * @return null|DateTime
231
     */
232 4
    public function getDateModified() : ? DateTime
233
    {
234 4
        return $this->dateModified;
235
    }
236
}
237