Lines
96.55%
28 / 29
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Process | 96.55% | 28 / 29 | 0.00% | 0 / 1 | 3 | 0.00% | 0 / 1 | |||
| readResponse | 96.55% | 28 / 29 | 0.00% | 0 / 1 | 3 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | /** | |
| 4 | * | |
| 5 | * @package Zmsticketprinter | |
| 6 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG | |
| 7 | * | |
| 8 | */ | |
| 9 | ||
| 10 | namespace BO\Zmsticketprinter; | |
| 11 | ||
| 12 | use BO\Slim\Render; | |
| 13 | use BO\Zmsclient\Exception\BadRequest; | |
| 14 | use BO\Zmsentities\Scope; | |
| 15 | use Psr\Http\Message\RequestInterface; | |
| 16 | use Psr\Http\Message\ResponseInterface; | |
| 17 | use BO\Zmsticketprinter\Helper\QueueListHelper; | |
| 18 | ||
| 19 | class 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 | } |