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