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