Completed
Pull Request — dev (#22)
by
unknown
03:11
created

Admin::eraseCredentials()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
ccs 0
cts 4
cp 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace AppBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
7
use Symfony\Component\Security\Core\User\UserInterface;
8
use Symfony\Component\Validator\Constraints as Assert;
9
10
/**
11
 * Admin.
12
 *
13
 * @ORM\Entity(repositoryClass="AppBundle\Repository\AdminRepository")
14
 */
15
class Admin implements UserInterface
16
{
17
    use ORMBehaviors\Timestampable\Timestampable;
18
    /**
19
     * @var int
20
     *
21
     * @ORM\Column(type="integer")
22
     * @ORM\Id
23
     * @ORM\GeneratedValue(strategy="AUTO")
24
     */
25
    private $id;
26
27
    /**
28
     * @var string
29
     * @Assert\NotBlank()
30
     * @Assert\Type("string")
31
     * @Assert\Length(
32
     *      min = 2,
33
     *      max = 190
34
     * )
35
     * @ORM\Column(type="string", length=190, unique=true)
36
     */
37
    private $userName;
38
39
    /**
40
     * @var string
41
     * @Assert\Email(
42
     *     checkMX = true
43
     * )
44
     * @Assert\Type("string")
45
     * @Assert\Length(
46
     *      max = 250
47
     * )
48
     * @ORM\Column(type="string", length=250, unique=true)
49
     */
50
    private $email;
51
52
    /**
53
     * @var string
54
     * @Assert\NotBlank()
55
     * @Assert\Type("string")
56
     * @Assert\Length(
57
     *      max = 255
58
     * )
59
     * @ORM\Column(type="string", length=255)
60
     */
61
    private $password;
62
63
    /**
64
     * @var string
65
     */
66
    private $plainPassword;
67
68
    /**
69
     * @var
70
     * @ORM\Column(type="json_array")
71
     */
72
    protected $roles;
73
74
    public function __construct()
75
    {
76
        $this->roles = array('ROLE_ADMIN');
77
    }
78
79
    /**
80
     * Get id.
81
     *
82
     * @return int
83
     */
84
    public function getId()
85
    {
86
        return $this->id;
87
    }
88
89
    /**
90
     * Set username.
91
     *
92
     * @param string $name
93
     *
94
     * @return Admin
95
     */
96
    public function setUsername($name)
97
    {
98
        $this->userName = $name;
99
100
        return $this;
101
    }
102
103
    /**
104
     * Get name.
105
     *
106
     * @return string
107
     */
108
    public function getUsername()
109
    {
110
        return $this->userName;
111
    }
112
113
    /**
114
     * Set email.
115
     *
116
     * @param string $email
117
     *
118
     * @return Admin
119
     */
120
    public function setEmail($email)
121
    {
122
        $this->email = $email;
123
124
        return $this;
125
    }
126
127
    /**
128
     * Get email.
129
     *
130
     * @return string
131
     */
132
    public function getEmail()
133
    {
134
        return $this->email;
135
    }
136
137
    /**
138
     * Set password.
139
     *
140
     * @param string $password
141
     *
142
     * @return Admin
143
     */
144
    public function setPassword($password)
145
    {
146
        $this->password = $password;
147
148
        return $this;
149
    }
150
151
    /**
152
     * Get password.
153
     *
154
     * @return string
155
     */
156
    public function getPassword()
157
    {
158
        return $this->password;
159
    }
160
161
    /**
162
     * @return string
163
     */
164
    public function getPlainPassword()
165
    {
166
        return $this->plainPassword;
167
    }
168
169
    /**
170
     * @param string $plainPassword
171
     */
172
    public function setPlainPassword($plainPassword)
173
    {
174
        $this->plainPassword = $plainPassword;
175
    }
176
177
    /**
178
     * @param mixed $roles
179
     */
180
    public function setRoles($roles)
181
    {
182
        $this->roles = $roles;
183
    }
184
185
    /**
186
     * @return mixed
187
     */
188
    public function getRoles()
189
    {
190
        return $this->roles;
191
    }
192
193
    public function getSalt()
194
    {
195
        // TODO: Implement getSalt() method.
196
    }
197
198
    public function eraseCredentials()
199
    {
200
        $this->setPlainPassword(null);
201
    }
202
}
203