Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
22 / 22 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
WarehouseReport | |
100.00% |
22 / 22 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
readResponse | |
100.00% |
22 / 22 |
|
100.00% |
1 / 1 |
2 |
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\WarehouseReport as Download; |
12 | use Psr\Http\Message\RequestInterface; |
13 | use Psr\Http\Message\ResponseInterface; |
14 | |
15 | class WarehouseReport extends BaseController |
16 | { |
17 | /** |
18 | * @SuppressWarnings(Param) |
19 | * @return ResponseInterface |
20 | */ |
21 | public function readResponse( |
22 | RequestInterface $request, |
23 | ResponseInterface $response, |
24 | array $args |
25 | ) { |
26 | $validator = $request->getAttribute('validator'); |
27 | $report = \App::$http |
28 | ->readGetResult('/warehouse/' . $args['subject'] . '/' . $args['subjectid'] . '/' . $args['period'] . '/') |
29 | ->getEntity(); |
30 | |
31 | $type = $validator->getParameter('type')->isString()->getValue(); |
32 | if ($type) { |
33 | $args['category'] = 'raw-' . $args['subject']; |
34 | $args['report'] = $report; |
35 | return (new Download(\App::$slim->getContainer()))->readResponse($request, $response, $args); |
36 | } |
37 | |
38 | return Render::withHtml( |
39 | $response, |
40 | 'page/warehouseReport.twig', |
41 | array( |
42 | 'title' => 'Kategorien', |
43 | 'menuActive' => 'warehouse', |
44 | 'report' => $report, |
45 | 'category' => $args['subject'], |
46 | 'subjectid' => $args['subjectid'], |
47 | 'period' => $args['period'], |
48 | 'workstation' => $this->workstation->getArrayCopy() |
49 | ) |
50 | ); |
51 | } |
52 | } |