Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
23 / 23
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Index
100.00% covered (success)
100.00%
23 / 23
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 readResponse
100.00% covered (success)
100.00%
23 / 23
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * @package ZMS API
5 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
6 **/
7
8namespace BO\Zmsapi;
9
10use BO\Slim\Render;
11use BO\Slim\Request;
12use Psr\Http\Message\RequestInterface;
13use Psr\Http\Message\ResponseInterface;
14
15class 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}