| Total Complexity | 12 |
| Total Lines | 113 |
| 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 | /** |
||
| 61 | * {@inheritdoc} |
||
| 62 | */ |
||
| 63 | public function getPassword(): ?string |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * {@inheritdoc} |
||
| 70 | */ |
||
| 71 | 1 | public function getPgt(): ?string |
|
| 72 | { |
||
| 73 | 1 | return $this->get('proxyGrantingTicket'); |
|
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * {@inheritdoc} |
||
| 78 | */ |
||
| 79 | 1 | public function getRoles(): array |
|
| 80 | { |
||
| 81 | 1 | return ['ROLE_CAS_AUTHENTICATED']; |
|
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * {@inheritdoc} |
||
| 86 | */ |
||
| 87 | public function getSalt(): ?string |
||
| 90 | } |
||
| 91 | |||
| 92 | /** |
||
| 93 | * {@inheritdoc} |
||
| 94 | */ |
||
| 95 | public function getUser(): string |
||
| 96 | { |
||
| 97 | trigger_deprecation( |
||
| 98 | 'ecphp/cas-bundle', |
||
| 99 | '2.1.2', |
||
| 100 | 'The method "%s::getUser()" is deprecated, use %s::getUsername() instead.', |
||
| 101 | CasUserInterface::class |
||
| 102 | ); |
||
| 103 | |||
| 104 | return $this->getUsername(); |
||
| 105 | } |
||
| 106 | |||
| 107 | /** |
||
| 108 | * {@inheritdoc} |
||
| 109 | */ |
||
| 110 | 1 | public function getUsername(): string |
|
| 113 | } |
||
| 114 | |||
| 115 | /** |
||
| 116 | * Get the storage. |
||
| 117 | * |
||
| 118 | * @return array<mixed> |
||
| 119 | */ |
||
| 120 | 4 | private function getStorage(): array |
|
| 123 | } |
||
| 124 | } |
||
| 125 |