Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
87.50% covered (warning)
87.50%
7 / 8
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
WarehouseReport
87.50% covered (warning)
87.50%
7 / 8
0.00% covered (danger)
0.00%
0 / 1
2.01
0.00% covered (danger)
0.00%
0 / 1
 readResponse
87.50% covered (warning)
87.50%
7 / 8
0.00% covered (danger)
0.00%
0 / 1
2.01
1<?php
2
3/**
4 * @package zmsstatistic
5 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
6 **/
7
8namespace BO\Zmsstatistic\Download;
9
10use BO\Zmsstatistic\Helper\Download;
11use Psr\Http\Message\RequestInterface;
12use Psr\Http\Message\ResponseInterface;
13
14class WarehouseReport extends Base
15{
16    /**
17     * @SuppressWarnings(Param)
18     * @return ResponseInterface
19     */
20    #[\Override]
21    public function readResponse(
22        RequestInterface $request,
23        ResponseInterface $response,
24        array $args
25    ) {
26        if (!empty($args['downloadTitle'])) {
27            $title = (string) $args['downloadTitle'];
28        } else {
29            $subjectId = $this->sanitizeDownloadFilenamePart((string) $args['subjectid']);
30            $period = $this->sanitizeDownloadFilenamePart((string) $args['period']);
31            $title = 'raw_statistic_' . $args['subject'] . '_' . $subjectId . '_' . $period;
32        }
33        $download = (new Download($request))->setSpreadSheet($title);
34
35        $this->writeRawReport($args['report'], $download->getSpreadSheet());
36
37        return $download->writeDownload($response);
38    }
39}