Lines
95.12%
39 / 41
Methods
50.00%
1 / 2
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| readResponse | 94.73% | 36 / 38 | 0.00% | 0 / 1 | 5.00 | ||
| [BO\Zmsticketprinter\BaseController] __invoke | 100.00% | 3 / 3 | 100.00% | 1 / 1 | 1 | ||
| 18 | class TicketprinterByScope extends BaseController | |
| 19 | { | |
| 20 | /** | |
| 21 | * @SuppressWarnings(UnusedFormalParameter) | |
| 22 | * @return ResponseInterface | |
| 23 | */ | |
| 24 | #[\Override] | |
| 25 | public function readResponse( | |
| 26 | RequestInterface $request, | |
| 27 | ResponseInterface $response, | |
| 28 | array $args | |
| 29 | ) { | |
| 30 | Helper\HomeUrl::create($request); | |
| 31 | ||
| 32 | $validator = $request->getAttribute('validator'); | |
| 33 | $defaultTemplate = $validator->getParameter("template") | |
| 34 | ->isPath() | |
| 35 | ->setDefault('default') | |
| 36 | ->getValue(); | |
| 37 | $ticketprinterHelper = (new Helper\Ticketprinter($args, $request)); | |
| 38 | $ticketprinter = $ticketprinterHelper->getEntity(); | |
| 39 | $scope = $ticketprinter->getScopeList()->getFirst(); | |
| 40 | $department = \App::$http->readGetResult('/scope/' . $scope->id . '/department/')->getEntity(); | |
| 41 | $organisation = $ticketprinterHelper->getOrganisation(); | |
| 42 | ||
| 43 | $queueListHelper = new QueueListHelper($scope); | |
| 44 | ||
| 45 | $template = (new TemplateFinder($defaultTemplate))->setCustomizedTemplate($ticketprinter, $organisation); | |
| 46 | ||
| 47 | $hasDisabledButton = false; | |
| 48 | foreach ($ticketprinter->buttons as $button) { | |
| 49 | if (!isset($button['enabled']) || $button['enabled'] != 1) { | |
| 50 | $hasDisabledButton = true; | |
| 51 | break; | |
| 52 | } | |
| 53 | } | |
| 54 | ||
| 55 | return Render::withHtml( | |
| 56 | $response, | |
| 57 | $template->getTemplate(), | |
| 58 | array( | |
| 59 | 'debug' => \App::DEBUG, | |
| 60 | 'enabled' => $ticketprinter->isEnabled() | |
| 61 | || !$organisation->getPreference('ticketPrinterActivation'), | |
| 62 | 'title' => 'Wartennumer ziehen', | |
| 63 | 'ticketprinter' => $ticketprinter, | |
| 64 | 'organisation' => $organisation, | |
| 65 | 'department' => $department, | |
| 66 | 'scope' => $scope, | |
| 67 | 'queueList' => $queueListHelper->getList(), | |
| 68 | 'waitingTime' => $queueListHelper->getEstimatedWaitingTime(), | |
| 69 | 'waitingTimeOptimistic' => $queueListHelper->getOptimisticWaitingTime(), | |
| 70 | 'waitingClients' => $queueListHelper->getClientsBefore(), | |
| 71 | 'buttonDisplay' => $template->getButtonTemplateType($ticketprinter), | |
| 72 | 'hasDisabledButton' => $hasDisabledButton | |
| 73 | ) | |
| 74 | ); | |
| 75 | } | |
| 76 | } |
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 | } |