Total Complexity | 12 |
Total Lines | 110 |
Duplicated Lines | 0 % |
Coverage | 56.67% |
Changes | 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 | 9 | public function __construct(array $data) |
|
25 | { |
||
26 | 9 | $this->storage = $data; |
|
27 | 9 | } |
|
28 | |||
29 | /** |
||
30 | * {@inheritdoc} |
||
31 | */ |
||
32 | public function eraseCredentials(): void |
||
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) |
|
50 | } |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | 1 | public function getAttributes(): array |
|
58 | } |
||
59 | |||
60 | public function getPassword(): ?string |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | 1 | public function getPgt(): ?string |
|
69 | { |
||
70 | 1 | return $this->get('proxyGrantingTicket'); |
|
71 | } |
||
72 | |||
73 | /** |
||
74 | * @return string[] |
||
75 | */ |
||
76 | 1 | public function getRoles(): array |
|
77 | { |
||
78 | 1 | return ['ROLE_CAS_AUTHENTICATED']; |
|
79 | } |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | public function getSalt(): ?string |
||
85 | { |
||
86 | return null; |
||
87 | } |
||
88 | |||
89 | /** |
||
90 | * {@inheritdoc} |
||
91 | */ |
||
92 | public function getUser(): string |
||
93 | { |
||
94 | trigger_deprecation( |
||
|
|||
95 | 'ecphp/cas-bundle', |
||
96 | '2.1.2', |
||
97 | 'The method "%s::getUser()" is deprecated, use %s::getUsername() instead.', |
||
98 | CasUserInterface::class |
||
99 | ); |
||
100 | |||
101 | return $this->getUsername(); |
||
102 | } |
||
103 | |||
104 | /** |
||
105 | * {@inheritdoc} |
||
106 | */ |
||
107 | 1 | public function getUsername(): string |
|
110 | } |
||
111 | |||
112 | /** |
||
113 | * Get the storage. |
||
114 | * |
||
115 | * @return array<mixed> |
||
116 | */ |
||
117 | 4 | private function getStorage(): array |
|
120 | } |
||
121 | } |
||
122 |