Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Ticketprinter
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 readResponse
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
1 / 1
2
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\Mellon\Validator;
12use BO\Zmsdb\Ticketprinter as Query;
13use BO\Zmsentities\Ticketprinter as Entity;
14
15/**
16 *
17 * @SuppressWarnings(Coupling)
18 *
19 */
20class Ticketprinter extends BaseController
21{
22    /**
23     * @SuppressWarnings(Param)
24     * @return String
25     */
26    public function readResponse(
27        \Psr\Http\Message\RequestInterface $request,
28        \Psr\Http\Message\ResponseInterface $response,
29        array $args
30    ) {
31        \BO\Zmsdb\Connection\Select::setCriticalReadSession();
32
33        $input = Validator::input()->isJson()->assertValid()->getValue();
34        $entity = new Entity($input);
35        $entity->testValid();
36
37        if (! $entity->toProperty()->buttons->isAvailable()) {
38            $entity = $entity->toStructuredButtonList();
39        }
40
41        $ticketprinter = (new Query())->readByButtonList($entity, \App::$now);
42        Helper\TicketprinterAccess::testTicketprinter($ticketprinter);
43
44        $message = Response\Message::create($request);
45        $message->data = $ticketprinter;
46
47        $response = Render::withLastModified($response, time(), '0');
48        $response = Render::withJson($response, $message->setUpdatedMetaData(), $message->getStatuscode());
49        return $response;
50    }
51}