Total Complexity | 11 |
Total Lines | 72 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | final class ApiGwAuthenticationUser implements ApiGwAuthenticationUserInterface |
||
15 | { |
||
16 | public string $sub; |
||
17 | |||
18 | /** |
||
19 | * The user storage. |
||
20 | * |
||
21 | * @var array<mixed> |
||
22 | */ |
||
23 | private array $storage; |
||
24 | |||
25 | /** |
||
26 | * @param array<mixed> $data |
||
27 | */ |
||
28 | 9 | public function __construct(string $username, array $data = []) |
|
29 | { |
||
30 | 9 | $this->sub = $username; |
|
31 | 9 | $this->storage = $data; |
|
32 | } |
||
33 | |||
34 | 3 | public static function createFromPayload($username, array $payload) |
|
35 | { |
||
36 | 3 | return new self($username, $payload); |
|
37 | } |
||
38 | |||
39 | public function eraseCredentials(): void |
||
40 | { |
||
41 | } |
||
42 | |||
43 | 1 | public function get(string $key, $default = null) |
|
44 | { |
||
45 | 1 | return $this->getStorage()[$key] ?? $default; |
|
46 | } |
||
47 | |||
48 | 1 | public function getAttribute(string $key, $default = null) |
|
49 | { |
||
50 | 1 | return $this->getStorage()[$key] ?? $default; |
|
51 | } |
||
52 | |||
53 | 1 | public function getAttributes(): array |
|
54 | { |
||
55 | 1 | return $this->getStorage(); |
|
56 | } |
||
57 | |||
58 | 1 | public function getPassword(): ?string |
|
59 | { |
||
60 | 1 | return null; |
|
61 | } |
||
62 | |||
63 | 1 | public function getRoles(): array |
|
64 | { |
||
65 | 1 | return ['IS_AUTHENTICATED_FULLY']; |
|
66 | } |
||
67 | |||
68 | 1 | public function getSalt(): ?string |
|
69 | { |
||
70 | 1 | return null; |
|
71 | } |
||
72 | |||
73 | 2 | public function getUsername(): string |
|
76 | } |
||
77 | |||
78 | /** |
||
79 | * Get the storage. |
||
80 | * |
||
81 | * @return array<mixed> |
||
82 | */ |
||
83 | 3 | private function getStorage(): array |
|
86 | } |
||
87 | } |
||
88 |