Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
GetUserEndpoint | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
handle | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Olz\Users\Endpoints; |
4 | |
5 | use Olz\Api\OlzGetEntityTypedEndpoint; |
6 | |
7 | /** |
8 | * @phpstan-import-type OlzUserId from UserEndpointTrait |
9 | * @phpstan-import-type OlzUserData from UserEndpointTrait |
10 | * |
11 | * @extends OlzGetEntityTypedEndpoint<OlzUserId, OlzUserData> |
12 | */ |
13 | class GetUserEndpoint extends OlzGetEntityTypedEndpoint { |
14 | use UserEndpointTrait; |
15 | |
16 | protected function handle(mixed $input): mixed { |
17 | $this->checkPermission('users'); |
18 | |
19 | $entity = $this->getEntityById($input['id']); |
20 | |
21 | return [ |
22 | 'id' => $entity->getId() ?? 0, |
23 | 'meta' => $entity->getMetaData(), |
24 | 'data' => $this->getEntityData($entity), |
25 | ]; |
26 | } |
27 | } |