Lines
87.50%
7 / 8
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| WarehouseReport | 87.50% | 7 / 8 | 0.00% | 0 / 1 | 2.01 | 0.00% | 0 / 1 | |||
| readResponse | 87.50% | 7 / 8 | 0.00% | 0 / 1 | 2.01 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | /** | |
| 4 | * @package zmsstatistic | |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG | |
| 6 | **/ | |
| 7 | ||
| 8 | namespace BO\Zmsstatistic\Download; | |
| 9 | ||
| 10 | use BO\Zmsstatistic\Helper\Download; | |
| 11 | use Psr\Http\Message\RequestInterface; | |
| 12 | use Psr\Http\Message\ResponseInterface; | |
| 13 | ||
| 14 | class 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 | ): mixed { | |
| 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 | } |