Completed
Push — master ( 622106...eab52f )
by Derek Stephen
02:07
created

User::getLastLoginDate()   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 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Del\Entity;
4
5
use DateTime;
6
use Del\Entity\Person;
7
use Del\Value\User\State;
8
9
/**
10
 * @Entity(repositoryClass="Del\Repository\User")
11
 */
12
class User
13
{
14
    /**
15
     * @Id
16
     * @Column(type="integer")
17
     * @GeneratedValue
18
     */
19
    private $id;
20
21
    /**
22
     * @Column(type="string",length=50)
23
     */
24
    private $email;
25
26
    /**
27
     * @OneToOne(targetEntity="Del\Entity\Person",cascade={"persist"})
28
     */
29
    private $person;
30
31
    /** @Column(type="string",length=100) */
32
    private $password;
33
34
    /**
35
     * @Column(type="integer",length=1)
36
     * @var int
37
     */
38
    private $state;
39
40
    /**
41
     * @Column(type="date",nullable=true)
42
     * @var DateTime
43
     */
44
    private $registrationDate;
45
46
    /**
47
     * @Column(type="date",nullable=true)
48
     * @var DateTime
49
     */
50
    private $lastLoginDate;
51
52
    /**
53
     * @Column(type="string",length=10, nullable=true)
54
     * @var string
55
     */
56
    private $token;
57
58 13
    public function __construct()
59
    {
60 13
        $this->state = 0;
61 13
    }
62
63
64 5
    public function getID()
65
    {
66 5
        return $this->id;
67
    }
68
69
    /**
70
     * @return mixed
71
     */
72 2
    public function getEmail()
73
    {
74 2
        return $this->email;
75
    }
76
77
    /**
78
     * @return Person
79
     */
80 1
    public function getPerson()
81
    {
82 1
        return $this->person;
83
    }
84
85
86 1
    public function getPassword()
87
    {
88 1
        return $this->password;
89
    }
90
91
    /**
92
     * @return State
93
     */
94 1
    public function getState()
95
    {
96 1
        return new State($this->state);
97
    }
98
99
    /**
100
     * @return DateTime
101
     */
102 1
    public function getRegistrationDate()
103
    {
104 1
        return $this->registrationDate;
105
    }
106
107
    /**
108
     * @return DateTime
109
     */
110 1
    public function getLastLoginDate()
111
    {
112 1
        return $this->lastLoginDate;
113
    }
114
115 5
    public function setID($id)
116
    {
117 5
        $this->id = $id;
118 5
        return $this;
119
    }
120
    /**
121
     * @param mixed $email
122
     * @return User
123
     */
124 3
    public function setEmail($email)
125
    {
126 3
        $this->email = $email;
127 3
        return $this;
128
    }
129
130 2
    public function setPerson(Person $person)
131
    {
132 2
        $this->person = $person;
133 2
        return $this;
134
    }
135
136 2
    public function setPassword($password)
137
    {
138 2
        $this->password = $password;
139 2
        return $this;
140
    }
141
142
    /**
143
     * @param State $state
144
     * @return User
145
     */
146 2
    public function setState(State $state)
147
    {
148 2
        $this->state = $state->getValue();
149 2
        return $this;
150
    }
151
152
    /**
153
     * @param DateTime $registrationDate
154
     * @return User
155
     */
156 2
    public function setRegistrationDate($registrationDate)
157
    {
158 2
        $this->registrationDate = $registrationDate;
159 2
        return $this;
160
    }
161
162
    /**
163
     * @param DateTime $lastLogin
164
     * @return User
165
     */
166 2
    public function setLastLogin(DateTime $lastLogin)
167
    {
168 2
        $this->lastLoginDate = $lastLogin;
169 2
        return $this;
170
    }
171
172
    /**
173
     * @return string
174
     */
175
    public function getToken()
176
    {
177
        return $this->token;
178
    }
179
180
    /**
181
     * @param string $token
182
     * @return User
183
     */
184
    public function setToken($token)
185
    {
186
        $this->token = $token;
187
        return $this;
188
    }
189
190
191
}