Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| ApiUser | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getRoles | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| eraseCredentials | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getUserIdentifier | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Security; |
| 4 | |
| 5 | use Symfony\Component\Security\Core\User\UserInterface; |
| 6 | |
| 7 | /** |
| 8 | * @phpstan-type UserRole 'ROLE_FRONTEND'|'ROLE_CLIENT'|'ROLE_ADMIN'|'ROLE_INTERNAL' |
| 9 | * |
| 10 | * @author Wilhelm Zwertvaegher |
| 11 | */ |
| 12 | readonly class ApiUser implements UserInterface |
| 13 | { |
| 14 | /** |
| 15 | * @param array<UserRole> $roles |
| 16 | */ |
| 17 | public function __construct( |
| 18 | private string $identifier, |
| 19 | private array $roles, |
| 20 | ) { |
| 21 | } |
| 22 | |
| 23 | public function getRoles(): array |
| 24 | { |
| 25 | return $this->roles; |
| 26 | } |
| 27 | |
| 28 | public function eraseCredentials(): void |
| 29 | { |
| 30 | } |
| 31 | |
| 32 | public function getUserIdentifier(): string |
| 33 | { |
| 34 | return $this->identifier; |
| 35 | } |
| 36 | } |