| Total Complexity | 11 |
| Total Lines | 98 |
| Duplicated Lines | 0 % |
| Coverage | 73.91% |
| 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 | 9 | public function __construct(array $data) |
|
| 22 | { |
||
| 23 | 9 | $this->storage = $data; |
|
| 24 | 9 | } |
|
| 25 | |||
| 26 | /** |
||
| 27 | * {@inheritdoc} |
||
| 28 | */ |
||
| 29 | public function eraseCredentials(): void |
||
| 30 | { |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * {@inheritdoc} |
||
| 35 | */ |
||
| 36 | 3 | public function get(string $key, $default = null) |
|
| 37 | { |
||
| 38 | 3 | return $this->getStorage()[$key] ?? $default; |
|
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * {@inheritdoc} |
||
| 43 | */ |
||
| 44 | 1 | public function getAttribute(string $key, $default = null) |
|
| 45 | { |
||
| 46 | 1 | return $this->getStorage()['attributes'][$key] ?? $default; |
|
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * {@inheritdoc} |
||
| 51 | */ |
||
| 52 | 1 | public function getAttributes(): array |
|
| 53 | { |
||
| 54 | 1 | return $this->get('attributes', []); |
|
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * {@inheritdoc} |
||
| 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 | * {@inheritdoc} |
||
| 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 |
||
| 87 | } |
||
| 88 | |||
| 89 | /** |
||
| 90 | * {@inheritdoc} |
||
| 91 | */ |
||
| 92 | 1 | public function getUsername(): string |
|
| 95 | } |
||
| 96 | |||
| 97 | /** |
||
| 98 | * Get the storage. |
||
| 99 | * |
||
| 100 | * @return array<mixed> |
||
| 101 | */ |
||
| 102 | 4 | private function getStorage(): array |
|
| 105 | } |
||
| 106 | } |
||
| 107 |