Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
21 / 21 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
DialogHandler | |
100.00% |
21 / 21 |
|
100.00% |
1 / 1 |
6 | |
100.00% |
1 / 1 |
readResponse | |
100.00% |
21 / 21 |
|
100.00% |
1 / 1 |
6 |
1 | <?php |
2 | |
3 | /** |
4 | * |
5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
6 | * |
7 | */ |
8 | |
9 | namespace BO\Zmsadmin\Helper; |
10 | |
11 | class DialogHandler extends \BO\Zmsadmin\BaseController |
12 | { |
13 | /** |
14 | * @SuppressWarnings(UnusedFormalParameter) |
15 | * @return String |
16 | */ |
17 | public function readResponse( |
18 | \Psr\Http\Message\RequestInterface $request, |
19 | \Psr\Http\Message\ResponseInterface $response, |
20 | array $args |
21 | ) { |
22 | $validator = $request->getAttribute('validator'); |
23 | $template = $validator->getParameter('template')->isString()->getValue(); |
24 | $parameter = $validator->getParameter('parameter')->isArray()->getValue(); |
25 | $parameter = ($parameter) ? $parameter : array(); |
26 | |
27 | if (isset($parameter['id'])) { |
28 | $result = \App::$http->readGetResult('/process/' . $parameter['id'] . '/'); |
29 | if ($result) { |
30 | $process = $result->getEntity(); |
31 | $parameter['settings']['isWithAppointment'] = $process->isWithAppointment(); |
32 | $parameter['settings']['hasMail'] = ( |
33 | $process->getFirstClient()->hasEmail() && $process->scope->hasEmailFrom() |
34 | ); |
35 | $parameter['settings']['hasTelephone'] = ( |
36 | $process->getFirstClient()->hasTelephone() && $process->scope->hasNotificationEnabled() |
37 | ); |
38 | $parameter['id'] = $process->queue->number; |
39 | } |
40 | } |
41 | |
42 | return \BO\Slim\Render::withHtml( |
43 | $response, |
44 | 'element/helper/dialog/' . $template . '.twig', |
45 | $parameter |
46 | ); |
47 | } |
48 | } |