Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
90.91% covered (success)
90.91%
20 / 22
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
CounterAppointmentTimes
90.91% covered (success)
90.91%
20 / 22
0.00% covered (danger)
0.00%
0 / 1
2.00
0.00% covered (danger)
0.00%
0 / 1
 readResponse
90.91% covered (success)
90.91%
20 / 22
0.00% covered (danger)
0.00%
0 / 1
2.00
1<?php
2
3/**
4 * @package Zmsadmin
5 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
6 **/
7
8namespace BO\Zmsadmin;
9
10class CounterAppointmentTimes extends BaseController
11{
12    /**
13     * @SuppressWarnings(Param)
14     * @return \Psr\Http\Message\ResponseInterface
15     */
16    #[\Override]
17    public function readResponse(
18        \Psr\Http\Message\RequestInterface $request,
19        \Psr\Http\Message\ResponseInterface $response,
20        array $args
21    ): \Psr\Http\Message\ResponseInterface {
22        $validator = $request->getAttribute('validator');
23        $selectedDate = $validator->getParameter('selecteddate')->isString()->getValue();
24        $dateTime = new \BO\Zmsentities\Helper\DateTime($selectedDate);
25        $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 0])->getEntity();
26
27        try {
28            $availabilityList = \App::$http
29            ->readGetResult('/scope/' . $workstation->scope['id'] . '/availability/', [
30                'startDate' => $selectedDate,
31                'endDate' => $selectedDate
32            ], \App::CONFIG_SECURE_TOKEN)
33            ->getCollection()
34            ->withDateTime($dateTime);
35        } catch (\Exception $e) {
36            $availabilityList = [];
37        }
38
39        return \BO\Slim\Render::withHtml(
40            $response,
41            'block/appointment/times.twig',
42            array(
43                'workstation' => $workstation,
44                'availabilityList' => $availabilityList,
45                'selectedDate' => $selectedDate
46            )
47        );
48    }
49}