Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
9 / 9 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
GetQuestionCategoryEndpoint | |
100.00% |
9 / 9 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
configure | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
handle | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Olz\Faq\Endpoints; |
4 | |
5 | use Olz\Api\OlzGetEntityTypedEndpoint; |
6 | |
7 | /** |
8 | * @phpstan-import-type OlzQuestionCategoryId from QuestionCategoryEndpointTrait |
9 | * @phpstan-import-type OlzQuestionCategoryData from QuestionCategoryEndpointTrait |
10 | * |
11 | * @extends OlzGetEntityTypedEndpoint<OlzQuestionCategoryId, OlzQuestionCategoryData> |
12 | */ |
13 | class GetQuestionCategoryEndpoint extends OlzGetEntityTypedEndpoint { |
14 | use QuestionCategoryEndpointTrait; |
15 | |
16 | public function configure(): void { |
17 | parent::configure(); |
18 | $this->phpStanUtils->registerTypeImport(QuestionCategoryEndpointTrait::class); |
19 | } |
20 | |
21 | protected function handle(mixed $input): mixed { |
22 | $this->checkPermission('any'); |
23 | |
24 | $entity = $this->getEntityById($input['id']); |
25 | |
26 | return [ |
27 | 'id' => $entity->getId() ?? 0, |
28 | 'meta' => $entity->getMetaData(), |
29 | 'data' => $this->getEntityData($entity), |
30 | ]; |
31 | } |
32 | } |