Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
WorkstationGet
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 readResponse
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3/**
4 * @package ZMS API
5 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
6 **/
7
8 namespace BO\Zmsapi;
9
10 use BO\Slim\Render;
11 use BO\Mellon\Validator;
12
13class WorkstationGet extends BaseController
14{
15    /**
16     * @SuppressWarnings(Param)
17     * @return String
18     */
19    public function readResponse(
20        \Psr\Http\Message\RequestInterface $request,
21        \Psr\Http\Message\ResponseInterface $response,
22        array $args
23    ) {
24        $resolveReferences = Validator::param('resolveReferences')->isNumber()->setDefault(1)->getValue();
25        $workstation = (new Helper\User($request, $resolveReferences))->checkRights();
26
27        // Check if the password field exists and remove it from the response
28        if (isset($workstation['useraccount']['password'])) {
29            unset($workstation['useraccount']['password']);
30        }
31
32        $message = Response\Message::create($request);
33        $message->data = $workstation;
34
35        $response = Render::withLastModified($response, time(), '0');
36        $response = Render::withJson($response, $message->setUpdatedMetaData(), $message->getStatuscode());
37        return $response;
38    }
39}