Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
21 / 21
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
WorkstationProcessProcessing
100.00% covered (success)
100.00%
21 / 21
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
1 / 1
 readResponse
100.00% covered (success)
100.00%
21 / 21
100.00% covered (success)
100.00%
1 / 1
3
1<?php
2
3/**
4 * @package Zmsadmin
5 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
6 **/
7
8namespace BO\Zmsadmin;
9
10use BO\Slim\Render;
11use BO\Zmsentities\Exception\WorkstationMissingAssignedProcess;
12
13class WorkstationProcessProcessing extends BaseController
14{
15    /**
16     * @SuppressWarnings(Param)
17     * @return \Psr\Http\Message\ResponseInterface
18     */
19    #[\Override]
20    public function readResponse(
21        \Psr\Http\Message\RequestInterface $request,
22        \Psr\Http\Message\ResponseInterface $response,
23        array $args
24    ): \Psr\Http\Message\ResponseInterface {
25        $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 2])->getEntity();
26        if (! $workstation->process->hasId()) {
27            throw new WorkstationMissingAssignedProcess();
28        }
29
30        // Re-saving an already processing process resets showUpTime (Bearbeitungszeit).
31        // Only transition called → processing here; otherwise just render the current view.
32        if ($workstation->process->getStatus() !== 'processing') {
33            $workstation->process->status = 'processing';
34            $workstation->process->parkedBy = null;
35            $workstation->process = \App::$http->readPostResult(
36                '/process/' . $workstation->process->id . '/' . $workstation->process->authKey . '/',
37                $workstation->process,
38                ['initiator' => 'admin']
39            )->getEntity();
40        }
41
42        $validator = $request->getAttribute('validator');
43        $error = $validator->getParameter('error')->isString()->getValue();
44
45        return Render::withHtml(
46            $response,
47            'block/process/info.twig',
48            array(
49                'workstation' => $workstation,
50                'error' => $error
51            )
52        );
53    }
54}