Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
9 / 9 |
|
100.00% |
7 / 7 |
CRAP | |
100.00% |
1 / 1 |
| SwaggerUIRedirectRouteDefinition | |
100.00% |
9 / 9 |
|
100.00% |
7 / 7 |
7 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getOperationId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getMethod | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getUrl | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getController | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getRouteAttributes | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| getUrlPrefixes | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\RestApi\RouteDefinitions; |
| 3 | |
| 4 | use Apie\Common\Enums\UrlPrefix; |
| 5 | use Apie\Common\Interfaces\HasRouteDefinition; |
| 6 | use Apie\Common\Lists\UrlPrefixList; |
| 7 | use Apie\Core\BoundedContext\BoundedContextId; |
| 8 | use Apie\Core\ContextConstants; |
| 9 | use Apie\Core\Enums\RequestMethod; |
| 10 | use Apie\Core\ValueObjects\UrlRouteDefinition; |
| 11 | use Apie\RestApi\Controllers\SwaggerUIRedirectController; |
| 12 | |
| 13 | class SwaggerUIRedirectRouteDefinition implements HasRouteDefinition |
| 14 | { |
| 15 | public function __construct(private readonly BoundedContextId $boundedContextId) |
| 16 | { |
| 17 | } |
| 18 | |
| 19 | public function getOperationId(): string |
| 20 | { |
| 21 | return 'swagger_ui_redirect'; |
| 22 | } |
| 23 | |
| 24 | public function getMethod(): RequestMethod |
| 25 | { |
| 26 | return RequestMethod::GET; |
| 27 | } |
| 28 | |
| 29 | public function getUrl(): UrlRouteDefinition |
| 30 | { |
| 31 | return new UrlRouteDefinition('/oauth2-redirect.html'); |
| 32 | } |
| 33 | |
| 34 | public function getController(): string |
| 35 | { |
| 36 | return SwaggerUIRedirectController::class; |
| 37 | } |
| 38 | |
| 39 | public function getRouteAttributes(): array |
| 40 | { |
| 41 | return [ |
| 42 | ContextConstants::BOUNDED_CONTEXT_ID => $this->boundedContextId->toNative(), |
| 43 | ]; |
| 44 | } |
| 45 | |
| 46 | public function getUrlPrefixes(): UrlPrefixList |
| 47 | { |
| 48 | return new UrlPrefixList([UrlPrefix::API]); |
| 49 | } |
| 50 | } |