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