Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| QueryResourceListRouteDefinition | |
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
5 | |
100.00% |
1 / 1 |
| createFrom | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
| getOperationId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getMethod | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getController | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\RestApi\RouteDefinitions; |
| 3 | |
| 4 | use Apie\Common\ActionDefinitions\ActionDefinitionInterface; |
| 5 | use Apie\Common\ActionDefinitions\GetResourceListActionDefinition; |
| 6 | use Apie\Core\Enums\RequestMethod; |
| 7 | use Apie\RestApi\Controllers\QueryResourceListController; |
| 8 | |
| 9 | /** |
| 10 | * Route definition for querying a list of resources with a request body. |
| 11 | */ |
| 12 | class QueryResourceListRouteDefinition extends GetResourceListRouteDefinition |
| 13 | { |
| 14 | public static function createFrom(ActionDefinitionInterface $actionDefinition): ?AbstractRestApiRouteDefinition |
| 15 | { |
| 16 | if ($actionDefinition instanceof GetResourceListActionDefinition) { |
| 17 | return new self($actionDefinition->getResourceName(), $actionDefinition->getBoundedContextId()); |
| 18 | } |
| 19 | |
| 20 | return null; |
| 21 | } |
| 22 | |
| 23 | public function getOperationId(): string |
| 24 | { |
| 25 | return 'query-all-' . $this->class->getShortName(); |
| 26 | } |
| 27 | |
| 28 | public function getMethod(): RequestMethod |
| 29 | { |
| 30 | return RequestMethod::QUERY; |
| 31 | } |
| 32 | |
| 33 | public function getController(): string |
| 34 | { |
| 35 | return QueryResourceListController::class; |
| 36 | } |
| 37 | } |