Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
10 / 10 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
GetWeeklyPictureEndpoint | |
100.00% |
10 / 10 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
configure | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
handle | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Olz\Startseite\Endpoints; |
4 | |
5 | use Olz\Api\OlzGetEntityTypedEndpoint; |
6 | |
7 | /** |
8 | * @phpstan-import-type OlzWeeklyPictureId from WeeklyPictureEndpointTrait |
9 | * @phpstan-import-type OlzWeeklyPictureData from WeeklyPictureEndpointTrait |
10 | * |
11 | * @extends OlzGetEntityTypedEndpoint<OlzWeeklyPictureId, OlzWeeklyPictureData> |
12 | */ |
13 | class GetWeeklyPictureEndpoint extends OlzGetEntityTypedEndpoint { |
14 | use WeeklyPictureEndpointTrait; |
15 | |
16 | public function configure(): void { |
17 | parent::configure(); |
18 | $this->configureWeeklyPictureEndpointTrait(); |
19 | $this->phpStanUtils->registerTypeImport(WeeklyPictureEndpointTrait::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 | } |