Lines
100.00%
14 / 14
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ScopeDelete | 100.00% | 14 / 14 | 100.00% | 1 / 1 | 1 | 100.00% | 1 / 1 | |||
| readResponse | 100.00% | 14 / 14 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | /** | |
| 4 | * | |
| 5 | * @package Zmsadmin | |
| 6 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG | |
| 7 | * | |
| 8 | */ | |
| 9 | ||
| 10 | namespace BO\Zmsadmin; | |
| 11 | ||
| 12 | use BO\Mellon\Validator; | |
| 13 | use BO\Slim\Render; | |
| 14 | ||
| 15 | /** | |
| 16 | * Delete a scope | |
| 17 | */ | |
| 18 | class ScopeDelete extends BaseController | |
| 19 | { | |
| 20 | /** | |
| 21 | * | |
| 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() | |
| 31 | ->getValue(); | |
| 32 | ||
| 33 | $entity = \App::$http->readGetResult('/scope/' . $entityId . '/')->getEntity(); | |
| 34 | $scopeName = $entity->offsetGet('contact')->offsetGet('name'); | |
| 35 | ||
| 36 | \App::$http->readDeleteResult('/scope/' . $entityId . '/') | |
| 37 | ->getEntity(); | |
| 38 | return \BO\Slim\Render::redirect( | |
| 39 | 'owner_overview', | |
| 40 | array(), | |
| 41 | array( | |
| 42 | 'success' => 'scope_deleted', | |
| 43 | 'scopeName' => $scopeName | |
| 44 | ) | |
| 45 | ); | |
| 46 | } | |
| 47 | } |