Lines 100.00% 23 / 23
Functions and Methods 100.00% 1 / 1
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
WorkstationProcess 100.00% 23 / 23 100.00% 1 / 1 5 100.00% 1 / 1
 readResponse 100.00% 23 / 23 100.00% 1 / 1 5
1<?php
2
3/**
4 * @package Zmsadmin
5 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
6 **/
7
8namespace BO\Zmsadmin;
9
10use DateTime;
11
12/**
13  * Init Controller to display next Button Template only
14  *
15  */
16class WorkstationProcess extends 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    ): \Psr\Http\Message\ResponseInterface {
28        $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 2])->getEntity();
29        $validator = $request->getAttribute('validator');
30        $lockClientActions = (bool) $validator->getParameter('lockClientActions')->isNumber()->getValue();
31        $template = ($workstation->process->hasId() && 'processing' == $workstation->process->status) ? 'info' : 'next';
32        $selectedDate = (new DateTime())->format('Y-m-d');
33        if ($workstation->process->hasId() && 'called' == $workstation->process->getStatus()) {
34            return \BO\Slim\Render::redirect(
35                'workstationProcessCalled',
36                array(
37                    'id' => $workstation->process->id
38                )
39            );
40        }
41        $workstationInfo = Helper\WorkstationInfo::getInfoBoxData($workstation, $selectedDate);
42        return \BO\Slim\Render::withHtml(
43            $response,
44            'block/process/' . $template . '.twig',
45            array(
46                'workstation' => $workstation,
47                'workstationInfo' => $workstationInfo,
48                'selectedDate' => $selectedDate,
49                'lockClientActions' => $lockClientActions
50            )
51        );
52    }
53}