Lines 100.00% 18 / 18
Functions and Methods 100.00% 1 / 1
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
WorkstationProcessCall 100.00% 18 / 18 100.00% 1 / 1 3 100.00% 1 / 1
 readResponse 100.00% 18 / 18 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\Mellon\Validator;
11
12class WorkstationProcessCall extends BaseController
13{
14    /**
15     * @SuppressWarnings(Param)
16     * @return \Psr\Http\Message\ResponseInterface
17     */
18    #[\Override]
19    public function readResponse(
20        \Psr\Http\Message\RequestInterface $request,
21        \Psr\Http\Message\ResponseInterface $response,
22        array $args
23    ): \Psr\Http\Message\ResponseInterface {
24        \App::$http->readGetResult('/workstation/', ['resolveReferences' => 1])->getEntity();
25        $processId = Validator::value($args['id'])->isNumber()->getValue();
26        $validator = $request->getAttribute('validator');
27        $isDirectCall = $validator->getParameter('direct')->isNumber()->getValue();
28        $process = \App::$http->readGetResult('/process/' . $processId . '/')->getEntity();
29        if ($process->toProperty()->amendment->get() && ! $isDirectCall) {
30            return \BO\Slim\Render::redirect(
31                'workstationProcessPreCall',
32                array(
33                    'id' => $process->id
34                )
35            );
36        }
37        return \BO\Slim\Render::redirect(
38            'workstationProcessCalled',
39            array(
40                'id' => $process->id
41            )
42        );
43    }
44}