| Total Complexity | 6 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | final class QueryParameter implements AuthenticationMethodInterface |
||
| 19 | { |
||
| 20 | private string $parameterName = 'access-token'; |
||
| 21 | private ?string $tokenType = null; |
||
| 22 | |||
| 23 | private IdentityWithTokenRepositoryInterface $identityRepository; |
||
| 24 | |||
| 25 | 10 | public function __construct(IdentityWithTokenRepositoryInterface $identityRepository) |
|
| 28 | 10 | } |
|
| 29 | |||
| 30 | 7 | public function authenticate(ServerRequestInterface $request): ?IdentityInterface |
|
| 38 | } |
||
| 39 | |||
| 40 | 2 | public function challenge(ResponseInterface $response): ResponseInterface |
|
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @param string $name The parameter name for passing the access token. |
||
| 47 | * |
||
| 48 | * @return $this |
||
| 49 | * |
||
| 50 | * @psalm-immutable |
||
| 51 | */ |
||
| 52 | 2 | public function withParameterName(string $name): self |
|
| 53 | { |
||
| 54 | 2 | $new = clone $this; |
|
| 55 | 2 | $new->parameterName = $name; |
|
| 56 | 2 | return $new; |
|
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @param string|null $type Identity token type |
||
| 61 | * |
||
| 62 | * @return $this |
||
| 63 | * |
||
| 64 | * @psalm-immutable |
||
| 65 | */ |
||
| 66 | 2 | public function withTokenType(?string $type): self |
|
| 71 | } |
||
| 72 | } |
||
| 73 |