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    public function readResponse(
25        RequestInterface $request,
26        ResponseInterface $response,
27        array $args
28    ) {
29        $base = $request->getBaseUrl();
30        $schema = [
31            '$schema' => "http://json-schema.org/draft-04/schema#",
32            'meta' => [
33                'type' => 'object',
34                '$ref' => "$base/doc/schema/metaresult.json",
35            ],
36            'swagger' => [
37                'type' => 'object',
38                '$ref' => "$base/doc/swagger.json",
39            ],
40            'data' => [
41                'type' => 'array',
42                'items' => [
43                    'type' => 'object',
44                    'oneOf' => [
45                        '$ref' => "$base/doc/schema/calendar.json",
46                    ]
47                ]
48            ],
49        ];
50
51        $response = Render::withLastModified($response, time(), '0');
52
53        return Render::withJson($response, $schema, 200);
54        ;
55    }
56}