Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
ApiUser
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getRoles
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 eraseCredentials
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getUserIdentifier
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Security;
4
5use 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 */
12readonly 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}

Paths

Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once. Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

ApiUser->__construct
17    public function __construct(
18        private string $identifier,
19        private array $roles,
20    ) {
21    }
ApiUser->eraseCredentials
30    }
ApiUser->getRoles
25        return $this->roles;
26    }
ApiUser->getUserIdentifier
34        return $this->identifier;
35    }
{main}
3namespace App\Security;
4
5use 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 */
12readonly 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    }