Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
GetKarteEndpoint
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 handle
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Olz\Karten\Endpoints;
4
5use 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 */
16class GetKarteEndpoint extends OlzGetEntityTypedEndpoint {
17    use KarteEndpointTrait;
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}