Code Coverage  | 
      ||||||||||
Lines  | 
       Functions and Methods  | 
       Classes and Traits  | 
      ||||||||
| Total |         | 
       100.00%  | 
       7 / 7  | 
               | 
       100.00%  | 
       1 / 1  | 
       CRAP |         | 
       100.00%  | 
       1 / 1  | 
      
| GetNewsEndpoint |         | 
       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\News\Endpoints; | 
| 4 | |
| 5 | use Olz\Api\OlzGetEntityTypedEndpoint; | 
| 6 | |
| 7 | /** | 
| 8 | * @phpstan-import-type OlzNewsId from NewsEndpointTrait | 
| 9 | * @phpstan-import-type OlzNewsData from NewsEndpointTrait | 
| 10 | * | 
| 11 | * TODO: Those should not be necessary! | 
| 12 | * @phpstan-import-type OlzNewsFormat from NewsEndpointTrait | 
| 13 | * | 
| 14 | * @extends OlzGetEntityTypedEndpoint<OlzNewsId, OlzNewsData> | 
| 15 | */ | 
| 16 | class GetNewsEndpoint extends OlzGetEntityTypedEndpoint { | 
| 17 | use NewsEndpointTrait; | 
| 18 | |
| 19 | protected function handle(mixed $input): mixed { | 
| 20 | $this->checkPermission('any'); | 
| 21 | |
| 22 | $entity = $this->getEntityById($input['id']); | 
| 23 | |
| 24 | return [ | 
| 25 | 'id' => $entity->getId() ?? 0, | 
| 26 | 'meta' => $entity->getMetaData(), | 
| 27 | 'data' => $this->getEntityData($entity), | 
| 28 | ]; | 
| 29 | } | 
| 30 | } |