Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
DepartmentDelete
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 readResponse
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * @package 115Mandant
5 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
6 **/
7
8namespace BO\Zmsadmin;
9
10use BO\Mellon\Validator;
11use BO\Slim\Render;
12use BO\Zmsentities\Department as Entity;
13
14/**
15  * Handle requests concerning services
16  *
17  */
18class DepartmentDelete extends BaseController
19{
20    /**
21     * @SuppressWarnings(Param)
22     * @return \Psr\Http\Message\ResponseInterface
23     */
24    #[\Override]
25    public function readResponse(
26        \Psr\Http\Message\RequestInterface $request,
27        \Psr\Http\Message\ResponseInterface $response,
28        array $args
29    ): \Psr\Http\Message\ResponseInterface {
30        $entityId = Validator::value($args['id'])->isNumber()->getValue();
31
32        $entity = \App::$http->readGetResult('/department/' . $entityId . '/')->getEntity();
33        $departmentName = $entity->name;
34
35
36        \App::$http->readDeleteResult(
37            '/department/' . $entityId . '/'
38        )->getEntity();
39        return \BO\Slim\Render::redirect(
40            'owner_overview',
41            array(),
42            array(
43                'success' => 'department_deleted',
44                'departmentName' => $departmentName            )
45        );
46    }
47}