Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
GetNewsEndpoint | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
handle | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Olz\News\Endpoints; |
4 | |
5 | use Olz\Api\OlzGetEntityTypedEndpoint; |
6 | |
7 | /** |
8 | * @phpstan-import-type OlzNewsId from NewsEndpointTrait |
9 | * @phpstan-import-type OlzNewsData from NewsEndpointTrait |
10 | * |
11 | * TODO: Those should not be necessary! |
12 | * @phpstan-import-type OlzNewsFormat from NewsEndpointTrait |
13 | * |
14 | * @extends OlzGetEntityTypedEndpoint<OlzNewsId, OlzNewsData> |
15 | */ |
16 | class GetNewsEndpoint extends OlzGetEntityTypedEndpoint { |
17 | use NewsEndpointTrait; |
18 | |
19 | protected function handle(mixed $input): mixed { |
20 | $this->checkPermission('any'); |
21 | |
22 | $entity = $this->getEntityById($input['id']); |
23 | |
24 | return [ |
25 | 'id' => $entity->getId() ?? 0, |
26 | 'meta' => $entity->getMetaData(), |
27 | 'data' => $this->getEntityData($entity), |
28 | ]; |
29 | } |
30 | } |