Lines 96.87% 31 / 32
Methods 50.00% 1 / 2
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 readResponse 96.55% 28 / 29 0.00% 0 / 1 3
 [BO\Zmsticketprinter\BaseController] __invoke 100.00% 3 / 3 100.00% 1 / 1 1
19class Process extends BaseController
20{
21    /**
22     * @SuppressWarnings(UnusedFormalParameter)
23     * @return ResponseInterface
24     */
25    #[\Override]
26    public function readResponse(
27        RequestInterface $request,
28        ResponseInterface $response,
29        array $args
30    ) {
31        $ticketprinterHelper = (new Helper\Ticketprinter($args, $request));
32        $validator = $request->getAttribute('validator');
33        $scopeId = $validator->getParameter('scopeId')->isNumber()->getValue();
34        $requestId = $validator->getParameter('requestId')->isNumber()->getValue();
35        $printText = $validator->getParameter('printText')->isString()->getValue();
36        if (null === $scopeId) {
37            throw new Exception\ScopeNotFound();
38        }
39
40        $process = \App::$http->readGetResult(
41            '/scope/' . $scopeId . '/waitingnumber/' . $ticketprinterHelper->getEntity()->hash . '/',
42            $requestId ? ['requestId' => $requestId] : null
43        )->getEntity();
44
45        $scope = new Scope($process->scope);
46        $department = \App::$http->readGetResult('/scope/' . $scope->getId() . '/department/')->getEntity();
47
48        $queueListHelper = (new QueueListHelper($scope, $process));
49
50        return Render::withHtml(
51            $response,
52            'page/process.twig',
53            array(
54                'debug' => \App::DEBUG,
55                'title' => 'Anmeldung an der Warteschlange',
56                'ticketprinter' => $ticketprinterHelper->getEntity(),
57                'organisation' => $ticketprinterHelper->getOrganisation(),
58                'process' => $process,
59                'printText' => $printText,
60                'waitingTime' => $queueListHelper->getEstimatedWaitingTime(),
61                'waitingClients' => ($queueListHelper->getClientsBefore()),
62                'department' => $department
63            )
64        );
65    }
66}

Inherited from BO\Zmsticketprinter\BaseController

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