Total Complexity | 12 |
Total Lines | 104 |
Duplicated Lines | 0 % |
Coverage | 76% |
Changes | 5 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | final class CasUser implements CasUserInterface |
||
11 | { |
||
12 | /** |
||
13 | * The user storage. |
||
14 | * |
||
15 | * @var array<mixed> |
||
16 | */ |
||
17 | private $storage; |
||
18 | |||
19 | /** |
||
20 | * CasUser constructor. |
||
21 | * |
||
22 | * @param array<mixed> $data |
||
23 | */ |
||
24 | 10 | public function __construct(array $data) |
|
25 | { |
||
26 | 10 | $this->storage = $data; |
|
27 | 10 | } |
|
28 | |||
29 | /** |
||
30 | * {@inheritdoc} |
||
31 | */ |
||
32 | public function eraseCredentials(): void |
||
33 | { |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | 3 | public function get(string $key, $default = null) |
|
40 | { |
||
41 | 3 | return $this->getStorage()[$key] ?? $default; |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | 1 | public function getAttribute(string $key, $default = null) |
|
48 | { |
||
49 | 1 | return $this->getStorage()['attributes'][$key] ?? $default; |
|
50 | } |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | 1 | public function getAttributes(): array |
|
56 | { |
||
57 | 1 | return $this->get('attributes', []); |
|
58 | } |
||
59 | |||
60 | /** |
||
61 | * {@inheritdoc} |
||
62 | */ |
||
63 | public function getPassword() |
||
64 | { |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | 1 | public function getPgt(): ?string |
|
71 | { |
||
72 | 1 | return $this->get('proxyGrantingTicket'); |
|
73 | } |
||
74 | |||
75 | /** |
||
76 | * {@inheritdoc} |
||
77 | */ |
||
78 | 1 | public function getRoles() |
|
79 | { |
||
80 | 1 | return ['ROLE_CAS_AUTHENTICATED']; |
|
81 | } |
||
82 | |||
83 | /** |
||
84 | * {@inheritdoc} |
||
85 | */ |
||
86 | public function getSalt() |
||
87 | { |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * {@inheritdoc} |
||
92 | */ |
||
93 | 1 | public function getUser(): string |
|
96 | } |
||
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | 1 | public function getUsername() |
|
102 | { |
||
103 | 1 | return $this->getUser(); |
|
104 | } |
||
105 | |||
106 | /** |
||
107 | * Get the storage. |
||
108 | * |
||
109 | * @return array<mixed> |
||
110 | */ |
||
111 | 4 | private function getStorage() |
|
114 | } |
||
115 | } |
||
116 |