Completed
Pull Request — dev (#27)
by
unknown
03:06
created

Admin::getSalt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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