Lines
100.00%
23 / 23
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Index | 100.00% | 23 / 23 | 100.00% | 1 / 1 | 1 | 100.00% | 1 / 1 | |||
| readResponse | 100.00% | 23 / 23 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | /** | |
| 4 | * @package ZMS API | |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG | |
| 6 | **/ | |
| 7 | ||
| 8 | namespace BO\Zmsbackend\Api; | |
| 9 | ||
| 10 | use BO\Slim\Render; | |
| 11 | use BO\Slim\Request; | |
| 12 | use Psr\Http\Message\RequestInterface; | |
| 13 | use Psr\Http\Message\ResponseInterface; | |
| 14 | ||
| 15 | class Index extends BaseController | |
| 16 | { | |
| 17 | /** | |
| 18 | * @SuppressWarnings(Param) | |
| 19 | * | |
| 20 | * @param RequestInterface|Request $request | |
| 21 | * @param ResponseInterface $response | |
| 22 | * @return ResponseInterface | |
| 23 | */ | |
| 24 | #[\Override] | |
| 25 | public function readResponse( | |
| 26 | RequestInterface $request, | |
| 27 | ResponseInterface $response, | |
| 28 | array $args | |
| 29 | ) { | |
| 30 | $base = $request->getBaseUrl(); | |
| 31 | $schema = [ | |
| 32 | '$schema' => "http://json-schema.org/draft-04/schema#", | |
| 33 | 'meta' => [ | |
| 34 | 'type' => 'object', | |
| 35 | '$ref' => "$base/doc/schema/metaresult.json", | |
| 36 | ], | |
| 37 | 'swagger' => [ | |
| 38 | 'type' => 'object', | |
| 39 | '$ref' => "$base/doc/swagger.json", | |
| 40 | ], | |
| 41 | 'data' => [ | |
| 42 | 'type' => 'array', | |
| 43 | 'items' => [ | |
| 44 | 'type' => 'object', | |
| 45 | 'oneOf' => [ | |
| 46 | '$ref' => "$base/doc/schema/calendar.json", | |
| 47 | ] | |
| 48 | ] | |
| 49 | ], | |
| 50 | ]; | |
| 51 | ||
| 52 | $response = Render::withLastModified($response, time(), '0'); | |
| 53 | ||
| 54 | return Render::withJson($response, $schema, 200); | |
| 55 | ; | |
| 56 | } | |
| 57 | } |