Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
TicketprinterWaitingnumberByScope
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 readResponse
100.00% covered (success)
100.00%
12 / 12
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\Request;
13use BO\Zmsdb\Ticketprinter as Query;
14use BO\Zmsdb\Scope;
15use BO\Zmsdb\ProcessStatusQueued;
16
17class TicketprinterWaitingnumberByScope extends BaseController
18{
19    /**
20     * @SuppressWarnings(Param)
21     * @return String
22     */
23    public function readResponse(
24        \Psr\Http\Message\RequestInterface $request,
25        \Psr\Http\Message\ResponseInterface $response,
26        array $args
27    ) {
28        \BO\Zmsdb\Connection\Select::getWriteConnection();
29        $validator = $request->getAttribute('validator');
30        $scope = (new Scope())->readEntity($args['id'], 0);
31        $requestId = $validator->getParameter('requestId')->isNumber()->getValue();
32        if (! $scope) {
33            throw new Exception\Scope\ScopeNotFound();
34        }
35
36        $process = ProcessStatusQueued::init()->writeNewFromTicketprinter($scope, \App::$now, [$requestId]);
37
38        $message = Response\Message::create($request);
39        $message->data = $process;
40
41        $response = Render::withLastModified($response, time(), '0');
42        $response = Render::withJson($response, $message->setUpdatedMetaData(), $message->getStatuscode());
43        return $response;
44    }
45}