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