Lines 96.77% 30 / 31
Functions and Methods 0.00% 0 / 1
Classes and Traits 0.00% 0 / 1
Name Lines Functions and Methods CRAP Classes and Traits
Overview 96.77% 30 / 31 0.00% 0 / 1 2 0.00% 0 / 1
 readResponse 96.77% 30 / 31 0.00% 0 / 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\Service\ReportCapacityService;
12use Psr\Http\Message\RequestInterface;
13use Psr\Http\Message\ResponseInterface;
14
15class Overview extends BaseController
16{
17    protected int $resolveLevel = 2;
18
19    /**
20     * @SuppressWarnings(Param)
21     * @return ResponseInterface
22     */
23    #[\Override]
24    public function readResponse(
25        RequestInterface $request,
26        ResponseInterface $response,
27        array $args
28    ): mixed {
29        $waitingPeriod = \App::http()
30            ->readGetResult('/warehouse/waitingscope/' . $this->workstation->scope['id'] . '/')
31            ->getEntity();
32        $clientPeriod = \App::http()
33            ->readGetResult('/warehouse/clientscope/' . $this->workstation->scope['id'] . '/')
34            ->getEntity();
35        $requestPeriod = \App::http()
36            ->readGetResult('/warehouse/requestscope/' . $this->workstation->scope['id'] . '/')
37            ->getEntity();
38        $useraccount = $this->workstation->getUseraccount();
39        $showCapacityReport = $useraccount->hasPermissions(['statistic', 'capacityreport']);
40        $capacityPeriod = $showCapacityReport
41            ? (new ReportCapacityService())->getCapacityPeriod($this->workstation->scope['id'])
42            : null;
43
44        return Render::withHtml(
45            $response,
46            'page/overview.twig',
47            array(
48                'title' => 'Statistik',
49                'workstation' => $this->workstation->getArrayCopy(),
50                'department' => $this->department,
51                'organisation' => $this->organisation,
52                'waitingPeriod' => $waitingPeriod,
53                'clientPeriod' => $clientPeriod,
54                'requestPeriod' => $requestPeriod,
55                'capacityPeriod' => $capacityPeriod,
56                'showCapacityReport' => $showCapacityReport,
57                'scopeId' => $this->workstation->scope['id'],
58                'showAll' => 0
59            )
60        );
61    }
62}