Completed
Push — master ( f1d84d...653498 )
by Derek Stephen
03:51
created

User   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 156
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 15
lcom 1
cbo 1
dl 0
loc 156
ccs 0
cts 67
cp 0
rs 10
c 0
b 0
f 0

15 Methods

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