BaseUser   A
last analyzed

Complexity

Total Complexity 15

Size/Duplication

Total Lines 158
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 23
c 3
b 0
f 0
dl 0
loc 158
ccs 30
cts 30
cp 1
rs 10
wmc 15

15 Methods

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