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

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    }