Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
90.00% |
9 / 10 |
|
87.50% |
7 / 8 |
CRAP | |
0.00% |
0 / 1 |
| LastActionResultRouteDefinition | |
90.00% |
9 / 10 |
|
87.50% |
7 / 8 |
8.06 | |
0.00% |
0 / 1 |
| __construct | |
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 | |||
| getOperationId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getAction | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getUrlPrefixes | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\Cms\RouteDefinitions; |
| 3 | |
| 4 | use Apie\Cms\Controllers\LastActionResultController; |
| 5 | use Apie\Common\Actions\GetListAction; |
| 6 | use Apie\Common\Enums\UrlPrefix; |
| 7 | use Apie\Common\Interfaces\HasRouteDefinition; |
| 8 | use Apie\Common\Lists\UrlPrefixList; |
| 9 | use Apie\Core\BoundedContext\BoundedContextId; |
| 10 | use Apie\Core\ContextConstants; |
| 11 | use Apie\Core\Enums\RequestMethod; |
| 12 | use Apie\Core\ValueObjects\UrlRouteDefinition; |
| 13 | |
| 14 | class LastActionResultRouteDefinition implements HasRouteDefinition |
| 15 | { |
| 16 | public function __construct(private readonly BoundedContextId $id) |
| 17 | { |
| 18 | } |
| 19 | |
| 20 | public function getMethod(): RequestMethod |
| 21 | { |
| 22 | return RequestMethod::GET; |
| 23 | } |
| 24 | |
| 25 | public function getUrl(): UrlRouteDefinition |
| 26 | { |
| 27 | return new UrlRouteDefinition('/last-action-result/{id}'); |
| 28 | } |
| 29 | /** |
| 30 | * @return class-string<object> |
| 31 | */ |
| 32 | public function getController(): string |
| 33 | { |
| 34 | return LastActionResultController::class; |
| 35 | } |
| 36 | /** |
| 37 | * @return array<string, mixed> |
| 38 | */ |
| 39 | public function getRouteAttributes(): array |
| 40 | { |
| 41 | return [ |
| 42 | ContextConstants::BOUNDED_CONTEXT_ID => $this->id->toNative(), |
| 43 | ]; |
| 44 | } |
| 45 | public function getOperationId(): string |
| 46 | { |
| 47 | return 'cms.last-action-result'; |
| 48 | } |
| 49 | |
| 50 | public function getAction(): string |
| 51 | { |
| 52 | return GetListAction::class; |
| 53 | } |
| 54 | |
| 55 | public function getUrlPrefixes(): UrlPrefixList |
| 56 | { |
| 57 | return new UrlPrefixList([UrlPrefix::CMS]); |
| 58 | } |
| 59 | } |