Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
AvailabilityCalcSlots
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 readResponse
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * @package Zmsadmin
5 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
6 **/
7
8namespace BO\Zmsadmin\Helper;
9
10use BO\Zmsadmin\BaseController;
11use BO\Zmsentities\Availability as Entity;
12use BO\Zmsentities\Collection\AvailabilityList as Collection;
13use BO\Zmsentities\Collection\ProcessList;
14
15class AvailabilityCalcSlots extends BaseController
16{
17    /**
18     * @SuppressWarnings(Param)
19     * @return \Psr\Http\Message\ResponseInterface
20     */
21    public function readResponse(
22        \Psr\Http\Message\RequestInterface $request,
23        \Psr\Http\Message\ResponseInterface $response,
24        array $args
25    ) {
26        \App::$http->readGetResult('/workstation/', ['resolveReferences' => 1])->getEntity();
27        $validator = $request->getAttribute('validator');
28        $input = $validator->getInput()->isJson()->assertValid()->getValue();
29        $collection = (new Collection())->addData($input['availabilityList']);
30
31        $data['maxWorkstationCount'] = $collection->getMaxWorkstationCount();
32        $data['maxSlots'] = $collection->getSummerizedSlotCount();
33        $data['busySlots'] = $input['busySlots'];
34
35        return \BO\Slim\Render::withJson(
36            $response,
37            $data
38        );
39    }
40}