User   A
last analyzed

Complexity

Total Complexity 16

Size/Duplication

Total Lines 139
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 23
c 1
b 0
f 0
dl 0
loc 139
ccs 0
cts 63
cp 0
rs 10
wmc 16

16 Methods

Rating   Name   Duplication   Size   Complexity  
A getSalt() 0 2 1
A getRoles() 0 7 1
A getStatus() 0 3 1
A getUsername() 0 3 1
A getId() 0 3 1
A setStatus() 0 3 1
A setEmail() 0 3 1
A eraseCredentials() 0 2 1
A getEmail() 0 3 1
A setLastName() 0 3 1
A setRoles() 0 5 1
A getFirstName() 0 3 1
A setFirstName() 0 3 1
A getPassword() 0 2 1
A setId() 0 3 1
A getLastName() 0 3 1
1
<?php
2
3
namespace App\Security;
4
5
use Symfony\Component\Security\Core\User\UserInterface;
6
use Ramsey\Uuid\UuidInterface;
7
8
class User implements UserInterface
9
{
10
    private $id;
11
    private $email;
12
    private $firstName;
13
    private $lastName;
14
    private $status;
15
    private $roles = [];
16
17
    /**
18
     * @param UuidInterface $id
19
     */
20
    public function setId(UuidInterface $id)
21
    {
22
        $this->id = $id;
23
    }
24
25
    /**
26
     * @return UuidInterface
27
     */
28
    public function getId(): UuidInterface
29
    {
30
        return $this->id;
31
    }
32
33
    /**
34
     * @param string $status
35
     */
36
    public function setStatus(string $status)
37
    {
38
        $this->status = $status;
39
    }
40
41
    /**
42
     * @return string
43
     */
44
    public function getStatus(): string
45
    {
46
        return $this->status;
47
    }
48
49
    /**
50
     * A visual identifier that represents this user.
51
     *
52
     * @see UserInterface
53
     */
54
    public function getUsername(): string
55
    {
56
        return (string) $this->id;
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function getFirstName(): string
63
    {
64
        return $this->firstName;
65
    }
66
67
    /**
68
     * @param string $firstName
69
     */
70
    public function setFirstName(string $firstName): void
71
    {
72
        $this->firstName = $firstName;
73
    }
74
75
    /**
76
     * @return string
77
     */
78
    public function getLastName(): string
79
    {
80
        return $this->lastName;
81
    }
82
83
    /**
84
     * @param string $lastName
85
     */
86
    public function setLastName(string $lastName): void
87
    {
88
        $this->lastName = $lastName;
89
    }
90
91
    /**
92
     * @see UserInterface
93
     */
94
    public function getRoles(): array
95
    {
96
        $roles = $this->roles;
97
        // guarantee every user at least has ROLE_USER
98
        $roles[] = 'ROLE_USER';
99
100
        return array_unique($roles);
101
    }
102
103
    public function setRoles(array $roles): self
104
    {
105
        $this->roles = $roles;
106
107
        return $this;
108
    }
109
110
    /**
111
     * @return string
112
     */
113
    public function getEmail(): string
114
    {
115
        return $this->email;
116
    }
117
118
    /**
119
     * @param string $email
120
     */
121
    public function setEmail(string $email): void
122
    {
123
        $this->email = $email;
124
    }
125
126
    /**
127
     * @see UserInterface
128
     */
129
    public function getPassword()
130
    {
131
        // not needed for apps that do not check user passwords
132
    }
133
134
    /**
135
     * @see UserInterface
136
     */
137
    public function getSalt()
138
    {
139
        // not needed for apps that do not check user passwords
140
    }
141
142
    /**
143
     * @see UserInterface
144
     */
145
    public function eraseCredentials()
146
    {
147
        // If you store any temporary, sensitive data on the user, clear it here
148
        // $this->plainPassword = null;
149
    }
150
}
151