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 String
19     */
20    public function readResponse(
21        \Psr\Http\Message\RequestInterface $request,
22        \Psr\Http\Message\ResponseInterface $response,
23        array $args
24    ) {
25        $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 2])->getEntity();
26        $validator = $request->getAttribute('validator');
27        $noRedirect = $validator->getParameter('noredirect')->isNumber()->getValue();
28        $action = strtolower((string) $validator->getParameter('action')->isString()->setDefault('')->getValue());
29
30        if ($workstation->process['id']) {
31            $deleteParameters = [];
32            if ($action !== '') {
33                $deleteParameters['action'] = $action;
34            }
35            \App::$http->readDeleteResult('/workstation/process/', $deleteParameters)->getEntity();
36        }
37        if (1 == $noRedirect) {
38            return $response;
39        }
40        return \BO\Slim\Render::redirect(
41            'workstationProcessCallButton',
42            array(),
43            array()
44        );
45    }
46}