Total Complexity | 7 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | #[AllowDynamicProperties] |
||
15 | final class BasicUser implements UserInterface |
||
16 | { |
||
17 | public string|int $id; |
||
18 | protected string $hashedPassword = ''; |
||
19 | public string|int $role; |
||
20 | |||
21 | /** |
||
22 | * @inheritDoc |
||
23 | */ |
||
24 | 1 | public function getAuthId(): string |
|
27 | } |
||
28 | |||
29 | /** |
||
30 | * @inheritDoc |
||
31 | */ |
||
32 | 1 | public function verifyPassword(string $password): bool |
|
33 | { |
||
34 | 1 | return password_verify($password, $this->hashedPassword); |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * @inheritDoc |
||
39 | */ |
||
40 | 1 | public function getAuthChecksum(): string |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * @inheritDoc |
||
47 | */ |
||
48 | 1 | public function getAuthRole(?Context $context = null): string|int |
|
49 | { |
||
50 | 1 | return $this->role; |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * @inheritDoc |
||
55 | */ |
||
56 | 1 | public function requiresMfa(): bool |
|
57 | { |
||
58 | 1 | return false; |
|
59 | } |
||
60 | |||
61 | /** |
||
62 | * Factory method; create object from data loaded from DB. |
||
63 | * |
||
64 | * @param array<string,mixed> $data |
||
65 | * @return self |
||
66 | */ |
||
67 | 2 | public static function fromData(array $data): self |
|
76 | } |
||
77 | } |
||
78 |