| Total Complexity | 7 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | class ApiKeyUser implements ApiKeyUserInterface, UserInterface |
||
| 25 | { |
||
| 26 | private string $identifier; |
||
| 27 | private string $apiKeyIdentifier; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var array<int, string> |
||
| 31 | */ |
||
| 32 | private array $roles; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * {@inheritdoc} |
||
| 36 | */ |
||
| 37 | 20 | public function __construct(ApiKey $apiKey, array $roles) |
|
| 38 | { |
||
| 39 | 20 | $this->identifier = $apiKey->getToken(); |
|
| 40 | 20 | $this->apiKeyIdentifier = $apiKey->getId(); |
|
| 41 | 20 | $this->roles = array_unique(array_merge($roles, [Role::ROLE_API->value])); |
|
|
|
|||
| 42 | } |
||
| 43 | |||
| 44 | 2 | public function getUserIdentifier(): string |
|
| 45 | { |
||
| 46 | 2 | return $this->identifier; |
|
| 47 | } |
||
| 48 | |||
| 49 | 7 | public function getApiKeyIdentifier(): string |
|
| 50 | { |
||
| 51 | 7 | return $this->apiKeyIdentifier; |
|
| 52 | } |
||
| 53 | |||
| 54 | 15 | public function getRoles(): array |
|
| 55 | { |
||
| 56 | 15 | return $this->roles; |
|
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @codeCoverageIgnore |
||
| 61 | */ |
||
| 62 | public function getPassword(): ?string |
||
| 63 | { |
||
| 64 | return null; |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @codeCoverageIgnore |
||
| 69 | */ |
||
| 70 | public function getSalt(): ?string |
||
| 71 | { |
||
| 72 | return null; |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @codeCoverageIgnore |
||
| 77 | */ |
||
| 78 | public function eraseCredentials(): void |
||
| 79 | { |
||
| 80 | } |
||
| 82 |