Lines
100.00%
26 / 26
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| readResponse | 100.00% | 23 / 23 | 100.00% | 1 / 1 | 1 | ||
| [BO\Zmsbackend\Api\BaseController] __invoke | 100.00% | 3 / 3 | 100.00% | 1 / 1 | 1 | ||
| 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 | } |
Inherited from BO\Zmsbackend\Api\BaseController
| 20 | public function __invoke(RequestInterface $request, ResponseInterface $response, array $args) | |
| 21 | { | |
| 22 | $request = $this->initRequest($request); | |
| 23 | $noCacheResponse = \BO\Slim\Render::withLastModified($response, time(), '0'); | |
| 24 | return $this->readResponse($request, $noCacheResponse, $args); | |
| 25 | } |