| Total Complexity | 9 |
| Total Lines | 89 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 11 | class User implements UserInterface |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var string |
||
| 15 | */ |
||
| 16 | private $email; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var string[] |
||
| 20 | */ |
||
| 21 | private $roles = []; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * User constructor. |
||
| 25 | * @param string|null $email |
||
| 26 | */ |
||
| 27 | public function __construct(string $email = null) |
||
| 28 | { |
||
| 29 | $this->email = $email; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @return string|null |
||
| 34 | */ |
||
| 35 | public function getEmail(): ?string |
||
| 36 | { |
||
| 37 | return $this->email; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param string $email |
||
| 42 | * @return $this |
||
| 43 | */ |
||
| 44 | public function setEmail(string $email): self |
||
| 45 | { |
||
| 46 | $this->email = $email; |
||
| 47 | |||
| 48 | return $this; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * A visual identifier that represents this user. |
||
| 53 | * |
||
| 54 | * @see UserInterface |
||
| 55 | */ |
||
| 56 | public function getUsername(): string |
||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @see UserInterface |
||
| 63 | */ |
||
| 64 | public function getRoles(): array |
||
| 65 | { |
||
| 66 | $roles = $this->roles; |
||
| 67 | $roles[] = 'ROLE_USER'; |
||
| 68 | |||
| 69 | return array_unique($roles); |
||
| 70 | } |
||
| 71 | |||
| 72 | public function setRoles(array $roles): self |
||
| 73 | { |
||
| 74 | $this->roles = $roles; |
||
| 75 | |||
| 76 | return $this; |
||
| 77 | } |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @see UserInterface |
||
| 81 | */ |
||
| 82 | public function getPassword() |
||
| 83 | { |
||
| 84 | // not needed for apps that do not check user passwords |
||
| 85 | } |
||
| 86 | |||
| 87 | /** |
||
| 88 | * @see UserInterface |
||
| 89 | */ |
||
| 90 | public function getSalt() |
||
| 92 | // not needed for apps that do not check user passwords |
||
| 93 | } |
||
| 94 | |||
| 95 | /** |
||
| 96 | * @see UserInterface |
||
| 97 | */ |
||
| 98 | public function eraseCredentials() |
||
| 100 | // If you store any temporary, sensitive data on the user, clear it here |
||
| 101 | } |
||
| 102 | } |
||
| 103 |