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 \Psr\Http\Message\ResponseInterface
25     */
26    #[\Override]
27    public function readResponse(
28        \Psr\Http\Message\RequestInterface $request,
29        \Psr\Http\Message\ResponseInterface $response,
30        array $args
31    ) {
32        \BO\Zmsdb\Connection\Select::setCriticalReadSession();
33
34        $input = Validator::input()->isJson()->assertValid()->getValue();
35        $entity = new Entity($input);
36        $entity->testValid();
37
38        if (! $entity->toProperty()->buttons->isAvailable()) {
39            $entity = $entity->toStructuredButtonList();
40        }
41
42        $ticketprinter = (new Query())->readByButtonList($entity, \App::$now);
43        Helper\TicketprinterAccess::testTicketprinter($ticketprinter);
44
45        $message = Response\Message::create($request);
46        $message->data = $ticketprinter;
47
48        $response = Render::withLastModified($response, time(), '0');
49        $response = Render::withJson($response, $message->setUpdatedMetaData(), $message->getStatuscode());
50        return $response;
51    }
52}