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