Lines
85.71%
24 / 28
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| WarehouseSubject | 85.71% | 24 / 28 | 0.00% | 0 / 1 | 3.03 | 0.00% | 0 / 1 | |||
| readResponse | 85.71% | 24 / 28 | 0.00% | 0 / 1 | 3.03 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | /** | |
| 4 | * @package Zmsadmin | |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG | |
| 6 | **/ | |
| 7 | ||
| 8 | namespace BO\Zmsstatistic; | |
| 9 | ||
| 10 | use BO\Slim\Render; | |
| 11 | use BO\Zmsstatistic\Download\WarehouseSubject as Download; | |
| 12 | use Psr\Http\Message\RequestInterface; | |
| 13 | use Psr\Http\Message\ResponseInterface; | |
| 14 | ||
| 15 | class WarehouseSubject extends BaseController | |
| 16 | { | |
| 17 | /** | |
| 18 | * @SuppressWarnings(Param) | |
| 19 | * @return ResponseInterface | |
| 20 | */ | |
| 21 | #[\Override] | |
| 22 | public function readResponse( | |
| 23 | RequestInterface $request, | |
| 24 | ResponseInterface $response, | |
| 25 | array $args | |
| 26 | ): mixed { | |
| 27 | /** @var \Psr\Http\Message\ServerRequestInterface $request */ | |
| 28 | $validator = $request->getAttribute('validator'); | |
| 29 | $subjectList = \App::http()->readGetResult('/warehouse/' . $args['subject'] . '/')->getEntity(); | |
| 30 | /** @var mixed $subjectList */ | |
| 31 | ||
| 32 | $type = $validator->getParameter('type')->isString()->getValue(); | |
| 33 | if ($type) { | |
| 34 | $args['category'] = 'raw-' . $args['subject']; | |
| 35 | $args['reports'][] = $subjectList; | |
| 36 | $args['department'] = $this->department; | |
| 37 | $args['organisation'] = $this->organisation; | |
| 38 | /** @var mixed $container */ | |
| 39 | $container = \App::$slim->getContainer(); | |
| 40 | return (new Download($container))->readResponse($request, $response, $args); | |
| 41 | } | |
| 42 | if (count($subjectList['data']) == 1) { | |
| 43 | return Render::redirect("WarehousePeriod", [ | |
| 44 | 'subject' => $args['subject'], | |
| 45 | 'subjectid' => $subjectList['data'][0][0], | |
| 46 | ]); | |
| 47 | } | |
| 48 | ||
| 49 | return Render::withHtml( | |
| 50 | $response, | |
| 51 | 'page/warehouseSubject.twig', | |
| 52 | array( | |
| 53 | 'title' => 'Kategorien', | |
| 54 | 'menuActive' => 'warehouse', | |
| 55 | 'dictionary' => $subjectList->dictionary, | |
| 56 | 'subjectList' => $subjectList->toHashed(), | |
| 57 | 'category' => $args['subject'], | |
| 58 | 'categoryName' => $subjectList['title'], | |
| 59 | 'workstation' => $this->workstation->getArrayCopy() | |
| 60 | ) | |
| 61 | ); | |
| 62 | } | |
| 63 | } |