Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
23 / 23
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
WarehouseReport
100.00% covered (success)
100.00%
23 / 23
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 readResponse
100.00% covered (success)
100.00%
23 / 23
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3/**
4 * @package Zmsadmin
5 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
6 **/
7
8namespace BO\Zmsstatistic;
9
10use BO\Slim\Render;
11use BO\Zmsstatistic\Download\WarehouseReport as Download;
12use Psr\Http\Message\RequestInterface;
13use Psr\Http\Message\ResponseInterface;
14
15class WarehouseReport 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        $report = \App::http()
30          ->readGetResult('/warehouse/' . $args['subject'] . '/' . $args['subjectid'] . '/' . $args['period'] . '/')
31          ->getEntity();
32
33        $type = $validator->getParameter('type')->isString()->getValue();
34        if ($type) {
35            $args['category'] = 'raw-' . $args['subject'];
36            $args['report'] = $report;
37            /** @var mixed $container */
38            $container = \App::$slim->getContainer();
39            return (new Download($container))->readResponse($request, $response, $args);
40        }
41
42        return Render::withHtml(
43            $response,
44            'page/warehouseReport.twig',
45            array(
46              'title' => 'Kategorien',
47              'menuActive' => 'warehouse',
48              'report' => $report,
49              'category' => $args['subject'],
50              'subjectid' => $args['subjectid'],
51              'period' => $args['period'],
52              'workstation' => $this->workstation->getArrayCopy()
53            )
54        );
55    }
56}