Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
ListTerminLabelsEndpoint
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 configure
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 handle
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Olz\Termine\Endpoints;
4
5use Olz\Api\OlzListEntitiesTypedEndpoint;
6
7/**
8 * @phpstan-import-type OlzTerminLabelId from TerminLabelEndpointTrait
9 * @phpstan-import-type OlzTerminLabelData from TerminLabelEndpointTrait
10 *
11 * @extends OlzListEntitiesTypedEndpoint<OlzTerminLabelId, OlzTerminLabelData>
12 */
13class ListTerminLabelsEndpoint extends OlzListEntitiesTypedEndpoint {
14    use TerminLabelEndpointTrait;
15
16    public function configure(): void {
17        parent::configure();
18        $this->phpStanUtils->registerTypeImport(TerminLabelEndpointTrait::class);
19    }
20
21    protected function handle(mixed $input): mixed {
22        $this->checkPermission('any');
23
24        $entities = $this->listEntities();
25
26        return [
27            'items' => array_map(function ($entity): array {
28                return [
29                    'id' => $entity->getId() ?? 0,
30                    'meta' => $entity->getMetaData(),
31                    'data' => $this->getEntityData($entity),
32                ];
33            }, $entities),
34        ];
35    }
36}