1 | <?php |
||
24 | final class SecurityUser implements UserInterface, EquatableInterface, ConstructableFromArrayInterface |
||
25 | { |
||
26 | use ConstructableFromArrayTrait; |
||
27 | |||
28 | /** |
||
29 | * @var UserId |
||
30 | */ |
||
31 | private $userId; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | private $username; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | private $password; |
||
42 | |||
43 | /** |
||
44 | * @var string[] |
||
45 | */ |
||
46 | private $roles; |
||
47 | |||
48 | public function __construct(UserId $userId, string $username, string $password, array $roles = []) |
||
55 | |||
56 | public static function fromUser(User $user): self |
||
60 | |||
61 | public function getUserId(): UserId |
||
65 | |||
66 | public function getUsername(): string |
||
70 | |||
71 | public function getPassword(): string |
||
75 | |||
76 | /** |
||
77 | * @var string[] |
||
78 | */ |
||
79 | public function getRoles(): array |
||
83 | |||
84 | /** |
||
85 | * Returns the salt that was originally used to encode the password. |
||
86 | * |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | public function getSalt(): ?string |
||
97 | |||
98 | /** |
||
99 | * Removes sensitive data from the user. |
||
100 | * |
||
101 | * {@inheritdoc} |
||
102 | */ |
||
103 | public function eraseCredentials(): void |
||
108 | |||
109 | public function isEqualTo(UserInterface $user): bool |
||
129 | } |
||
130 |