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