Lines 100.00% 15 / 15
Methods 100.00% 2 / 2
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 readResponse 100.00% 12 / 12 100.00% 1 / 1 2
 [BO\Zmsbackend\Api\BaseController] __invoke 100.00% 3 / 3 100.00% 1 / 1 1
17class TicketprinterWaitingnumberByScope extends \BO\Zmsbackend\Api\BaseController
18{
19    /**
20     * @SuppressWarnings(Param)
21     * @return \Psr\Http\Message\ResponseInterface
22     */
23    #[\Override]
24    public function readResponse(
25        \Psr\Http\Message\RequestInterface $request,
26        \Psr\Http\Message\ResponseInterface $response,
27        array $args
28    ) {
29        \BO\Zmsbackend\Connection\Select::getWriteConnection();
30        $validator = $request->getAttribute('validator');
31        $scope = (new \BO\Zmsbackend\Scope\Service\Scope())->readEntity($args['id'], 0);
32        $requestId = $validator->getParameter('requestId')->isNumber()->getValue();
33        if (! $scope) {
34            throw new \BO\Zmsbackend\Scope\Exception\ScopeNotFound();
35        }
36
37        $process = \BO\Zmsbackend\Process\Service\ProcessStatusQueued::init()->writeNewFromTicketprinter($scope, \App::$now, [$requestId]);
38
39        $message = \BO\Zmsbackend\Api\Response\Message::create($request);
40        $message->data = $process;
41
42        $response = Render::withLastModified($response, time(), '0');
43        $response = Render::withJson($response, $message->setUpdatedMetaData(), $message->getStatuscode());
44        return $response;
45    }
46}

Inherited from BO\Zmsbackend\Api\BaseController

20    public function __invoke(RequestInterface $request, ResponseInterface $response, array $args)
21    {
22        $request = $this->initRequest($request);
23        $noCacheResponse = \BO\Slim\Render::withLastModified($response, time(), '0');
24        return $this->readResponse($request, $noCacheResponse, $args);
25    }