Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
22 / 22
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
WarehouseReport
100.00% covered (success)
100.00%
22 / 22
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 readResponse
100.00% covered (success)
100.00%
22 / 22
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    ) {
27        $validator = $request->getAttribute('validator');
28        $report = \App::$http
29          ->readGetResult('/warehouse/' . $args['subject'] . '/' . $args['subjectid'] . '/' . $args['period'] . '/')
30          ->getEntity();
31
32        $type = $validator->getParameter('type')->isString()->getValue();
33        if ($type) {
34            $args['category'] = 'raw-' . $args['subject'];
35            $args['report'] = $report;
36            return (new Download(\App::$slim->getContainer()))->readResponse($request, $response, $args);
37        }
38
39        return Render::withHtml(
40            $response,
41            'page/warehouseReport.twig',
42            array(
43              'title' => 'Kategorien',
44              'menuActive' => 'warehouse',
45              'report' => $report,
46              'category' => $args['subject'],
47              'subjectid' => $args['subjectid'],
48              'period' => $args['period'],
49              'workstation' => $this->workstation->getArrayCopy()
50            )
51        );
52    }
53}