Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
24 / 24
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Calldisplay
100.00% covered (success)
100.00%
24 / 24
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 readResponse
100.00% covered (success)
100.00%
24 / 24
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3/**
4 * @package Zmsadmin
5 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
6 **/
7
8namespace BO\Zmsadmin;
9
10use BO\Mellon\Validator;
11use BO\Zmsentities\Department;
12use BO\Zmsentities\Collection\DepartmentList;
13
14class Calldisplay extends BaseController
15{
16    /**
17     * @SuppressWarnings(Param)
18     * @return String
19     */
20    public function readResponse(
21        \Psr\Http\Message\RequestInterface $request,
22        \Psr\Http\Message\ResponseInterface $response,
23        array $args
24    ) {
25        $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 1])->getEntity();
26        $scopeId = $workstation['scope']['id'];
27        $entityId = Validator::value($scopeId)->isNumber()->getValue();
28
29        $config = \App::$http->readGetResult('/config/')->getEntity();
30
31        $entity = \App::$http->readGetResult(
32            '/scope/' . $entityId . '/organisation/',
33            ['resolveReferences' => 3]
34        )->getEntity();
35
36        $departments = new DepartmentList();
37
38        foreach ($entity->departments as $departmentData) {
39            $department = (new Department($departmentData))->withCompleteScopeList();
40            $departments->addEntity($department);
41        }
42
43        return \BO\Slim\Render::withHtml(
44            $response,
45            'page/calldisplay.twig',
46            array(
47                'title' => 'Aufrufanzeige',
48                'config' => $config->getArrayCopy(),
49                'organisation' => $entity->getArrayCopy(),
50                'departments' => $departments->getArrayCopy(),
51                'workstation' => $workstation,
52                'menuActive' => 'calldisplay'
53            )
54        );
55    }
56}