Completed
Push — master ( 585d40...a6f122 )
by Derek Stephen
02:36
created

User::setToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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