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