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    public function readResponse(
19        RequestInterface $request,
20        ResponseInterface $response,
21        array $args
22    ): ResponseInterface {
23        (new Helper\User($request))->checkRights('useraccount');
24        $resolveReferences = Validator::param('resolveReferences')->isNumber()->setDefault(1)->getValue();
25        $department = Helper\User::checkDepartment($args['id']);
26
27        $workstationList = (new Workstation())->readCollectionByDepartmentId($department->id, $resolveReferences);
28        $message = Response\Message::create($request);
29        $message->data = $workstationList;
30
31        $response = Render::withLastModified($response, time(), '0');
32
33        return Render::withJson($response, $message, 200);
34    }
35}