Completed
Pull Request — master (#12)
by
unknown
03:18
created

User::eraseCredentials()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace SumoCoders\FrameworkMultiUserBundle\User;
4
5
use SumoCoders\FrameworkMultiUserBundle\Security\PasswordResetToken;
6
7
class User implements UserInterface, PasswordReset
8
{
9
    /** @var string */
10
    private $username;
11
12
    /** @var string */
13
    private $password;
14
15
    /** @var string */
16
    private $displayName;
17
18
    /** @var */
19
    private $passwordResetToken;
20
21
    /** @var */
22
    private $email;
23
24
    /**
25
     * @param string $username
26
     * @param string $password
27
     * @param string $displayName
28
     */
29 View Code Duplication
    public function __construct($username, $password, $displayName, $email)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
    {
31
        $this->username = $username;
32
        $this->password = $password;
33
        $this->displayName = $displayName;
34
        $this->email = $email;
35
    }
36
37
    /**
38
     * {@inheritDoc}
39
     */
40
    public function getRoles()
41
    {
42
        return [ 'ROLE_USER' ];
43
    }
44
45
    /**
46
     * {@inheritDoc}
47
     */
48
    public function getPassword()
49
    {
50
        return $this->password;
51
    }
52
53
    /**
54
     * {@inheritDoc}
55
     */
56
    public function getSalt()
57
    {
58
        return;
59
    }
60
61
    /**
62
     * {@inheritDoc}
63
     */
64
    public function getUsername()
65
    {
66
        return $this->username;
67
    }
68
69
    /**
70
     * {@inheritDoc}
71
     */
72
    public function eraseCredentials()
73
    {
74
        return;
75
    }
76
77
    /**
78
     * {@inheritDoc}
79
     */
80
    public function getDisplayName()
81
    {
82
        return $this->displayName;
83
    }
84
85
    /**
86
     * {@inheritDoc}
87
     */
88
    public function __toString()
89
    {
90
        return $this->getDisplayName();
91
    }
92
93
    /**
94
     * {@inheritdoc}
95
     */
96
    public function clearPasswordResetToken()
97
    {
98
        $this->passwordResetToken = null;
99
100
        return $this;
101
    }
102
103
    /**
104
     * @return self
105
     */
106
    public function generatePasswordResetToken()
107
    {
108
        $this->passwordResetToken = PasswordResetToken::generate();
109
110
        return $this;
111
    }
112
113
    /**
114
     * @return string
115
     */
116
    public function getPasswordResetToken()
117
    {
118
        return $this->passwordResetToken;
119
    }
120
121
    /**
122
     * @return string
123
     */
124
    public function getEmail()
125
    {
126
        return $this->email;
127
    }
128
129
    /**
130
     * @param $email
131
     *
132
     * @return self
133
     */
134
    public function setEmail($email)
135
    {
136
        $this->email = $email;
137
138
        return $this;
139
    }
140
141
    /**
142
     * @param $password
143
     *
144
     * @return self
145
     */
146
    public function setPassword($password)
147
    {
148
        $this->password = $password;
149
150
        return $this;
151
    }
152
}
153