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