Lines
100.00%
39 / 39
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ReportRequestOrganisation | 100.00% | 39 / 39 | 100.00% | 1 / 1 | 4 | 100.00% | 1 / 1 | |||
| readResponse | 100.00% | 39 / 39 | 100.00% | 1 / 1 | 4 | |||||
| 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 Psr\Http\Message\RequestInterface; | |
| 12 | use Psr\Http\Message\ResponseInterface; | |
| 13 | ||
| 14 | class ReportRequestOrganisation extends BaseController | |
| 15 | { | |
| 16 | protected array $hashset = [ | |
| 17 | 'requestscount' | |
| 18 | ]; | |
| 19 | ||
| 20 | protected array $groupfields = [ | |
| 21 | 'name', | |
| 22 | 'date' | |
| 23 | ]; | |
| 24 | ||
| 25 | /** | |
| 26 | * @SuppressWarnings(Param) | |
| 27 | * @return ResponseInterface | |
| 28 | */ | |
| 29 | #[\Override] | |
| 30 | public function readResponse( | |
| 31 | RequestInterface $request, | |
| 32 | ResponseInterface $response, | |
| 33 | array $args | |
| 34 | ): mixed { | |
| 35 | /** @var \Psr\Http\Message\ServerRequestInterface $request */ | |
| 36 | $validator = $request->getAttribute('validator'); | |
| 37 | $requestPeriod = \App::http() | |
| 38 | ->readGetResult('/warehouse/requestorganisation/' . $this->organisation->id . '/') | |
| 39 | ->getEntity(); | |
| 40 | $exchangeRequest = null; | |
| 41 | if (isset($args['period'])) { | |
| 42 | /** @var mixed $entity */ | |
| 43 | $entity = \App::http() | |
| 44 | ->readGetResult('/warehouse/requestorganisation/' . $this->organisation->id . '/' . $args['period'] . '/') | |
| 45 | ->getEntity(); | |
| 46 | $exchangeRequest = $entity | |
| 47 | ->toGrouped($this->groupfields, $this->hashset) | |
| 48 | ->withRequestsSum() | |
| 49 | ->withAverage('processingtime') | |
| 50 | ->withWeightedAverageProcessingTime() | |
| 51 | ->withUncapturedRequestRowSortedLast(); | |
| 52 | } | |
| 53 | ||
| 54 | $type = $validator->getParameter('type')->isString()->getValue(); | |
| 55 | if ($type) { | |
| 56 | $args['category'] = 'requestorganisation'; | |
| 57 | $args['reports'][] = $exchangeRequest; | |
| 58 | $args['organisation'] = $this->organisation; | |
| 59 | /** @var mixed $container */ | |
| 60 | $container = \App::$slim->getContainer(); | |
| 61 | return (new Download\RequestReport($container))->readResponse($request, $response, $args); | |
| 62 | } | |
| 63 | ||
| 64 | return Render::withHtml( | |
| 65 | $response, | |
| 66 | 'page/reportRequestIndex.twig', | |
| 67 | array( | |
| 68 | 'title' => 'Dienstleistungsstatistik Bezirk', | |
| 69 | 'activeOrganisation' => 'active', | |
| 70 | 'menuActive' => 'request', | |
| 71 | 'department' => $this->department, | |
| 72 | 'organisation' => $this->organisation, | |
| 73 | 'requestPeriod' => $requestPeriod, | |
| 74 | 'showAll' => 1, | |
| 75 | 'period' => (isset($args['period'])) ? $args['period'] : null, | |
| 76 | 'exchangeRequest' => $exchangeRequest, | |
| 77 | 'source' => ['entity' => 'RequestOrganisation'], | |
| 78 | 'workstation' => $this->workstation->getArrayCopy() | |
| 79 | ) | |
| 80 | ); | |
| 81 | } | |
| 82 | } |