Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
15 / 15
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
TicketprinterListByScopeList
100.00% covered (success)
100.00%
15 / 15
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 readResponse
100.00% covered (success)
100.00%
15 / 15
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
8namespace BO\Zmsapi;
9
10use BO\Slim\Render;
11use BO\Mellon\Validator;
12
13class TicketprinterListByScopeList 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        (new Helper\User($request))->checkRights();
25        $scopeIdList = explode(',', $args['ids']);
26
27        $ticketprinterList = new \BO\Zmsentities\Collection\TicketprinterList();
28        foreach ($scopeIdList as $scopeId) {
29            $isEnabled = (new \BO\Zmsdb\Scope())->readIsEnabled($scopeId, \App::$now);
30            $entity = (new \BO\Zmsentities\Ticketprinter([
31                'enabled' => $isEnabled,
32                'buttonlist' => 's' . $scopeId
33            ]));
34            $ticketprinterList->addEntity($entity->toStructuredButtonList());
35        }
36
37        $message = Response\Message::create($request);
38        $message->data = $ticketprinterList;
39
40        $response = Render::withLastModified($response, time(), '0');
41        $response = Render::withJson($response, $message, 200);
42        return $response;
43    }
44}