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