Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
DepartmentWorkstationList
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 readResponse
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * @package ZMS API
5 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
6 **/
7
8namespace BO\Zmsapi;
9
10use BO\Slim\Render;
11use BO\Mellon\Validator;
12use BO\Zmsdb\Workstation;
13use Psr\Http\Message\RequestInterface;
14use Psr\Http\Message\ResponseInterface;
15
16class DepartmentWorkstationList extends BaseController
17{
18    #[\Override]
19    public function readResponse(
20        RequestInterface $request,
21        ResponseInterface $response,
22        array $args
23    ): ResponseInterface {
24        (new Helper\User($request))->checkRights('useraccount');
25        $resolveReferences = Validator::param('resolveReferences')->isNumber()->setDefault(1)->getValue();
26        $department = Helper\User::checkDepartment($args['id']);
27
28        $workstationList = (new Workstation())->readCollectionByDepartmentId($department->id, $resolveReferences);
29        $message = Response\Message::create($request);
30        $message->data = $workstationList;
31
32        $response = Render::withLastModified($response, time(), '0');
33
34        return Render::withJson($response, $message, 200);
35    }
36}