Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
GetRegistrationEndpoint
100.00% covered (success)
100.00%
11 / 11
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%
8 / 8
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Olz\Apps\Anmelden\Endpoints;
4
5use Olz\Api\OlzGetEntityTypedEndpoint;
6
7/**
8 * @phpstan-import-type OlzRegistrationId from RegistrationEndpointTrait
9 * @phpstan-import-type OlzRegistrationData from RegistrationEndpointTrait
10 *
11 * TODO: Those should not be necessary!
12 * @phpstan-import-type OlzRegistrationInfo from RegistrationEndpointTrait
13 * @phpstan-import-type ValidRegistrationInfoType from RegistrationEndpointTrait
14 *
15 * @extends OlzGetEntityTypedEndpoint<OlzRegistrationId, OlzRegistrationData>
16 */
17class GetRegistrationEndpoint extends OlzGetEntityTypedEndpoint {
18    use RegistrationEndpointTrait;
19
20    public function configure(): void {
21        parent::configure();
22        $this->configureRegistrationEndpointTrait();
23        $this->phpStanUtils->registerTypeImport(RegistrationEndpointTrait::class);
24    }
25
26    protected function handle(mixed $input): mixed {
27        $external_id = $input['id'];
28        $internal_id = $this->idUtils()->toInternalId($external_id, 'Registration');
29
30        $entity = $this->getEntityById($internal_id);
31
32        return [
33            'id' => $external_id,
34            'meta' => $entity->getMetaData(),
35            'data' => $this->getEntityData($entity),
36        ];
37    }
38}