Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
WorkstationProcessCancel
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
1 / 1
4
100.00% covered (success)
100.00%
1 / 1
 readResponse
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
1 / 1
4
1<?php
2
3/**
4 * @package Zmsadmin
5 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
6 **/
7
8namespace BO\Zmsadmin;
9
10/**
11  * Init Controller to display next Button Template only
12  *
13  */
14class WorkstationProcessCancel extends BaseController
15{
16    /**
17     * @SuppressWarnings(Param)
18     * @return \Psr\Http\Message\ResponseInterface
19     */
20    #[\Override]
21    public function readResponse(
22        \Psr\Http\Message\RequestInterface $request,
23        \Psr\Http\Message\ResponseInterface $response,
24        array $args
25    ): \Psr\Http\Message\ResponseInterface {
26        $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 2])->getEntity();
27        $validator = $request->getAttribute('validator');
28        $noRedirect = $validator->getParameter('noredirect')->isNumber()->getValue();
29        $action = strtolower((string) $validator->getParameter('action')->isString()->setDefault('')->getValue());
30
31        if ($workstation->process['id']) {
32            $deleteParameters = [];
33            if ($action !== '') {
34                $deleteParameters['action'] = $action;
35            }
36            \App::$http->readDeleteResult('/workstation/process/', $deleteParameters)->getEntity();
37        }
38        if (1 == $noRedirect) {
39            return $response;
40        }
41        return \BO\Slim\Render::redirect(
42            'workstationProcessCallButton',
43            array(),
44            array()
45        );
46    }
47}