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 \Psr\Http\Message\ResponseInterface
18     */
19    #[\Override]
20    public function readResponse(
21        \Psr\Http\Message\RequestInterface $request,
22        \Psr\Http\Message\ResponseInterface $response,
23        array $args
24    ) {
25        (new Helper\User($request))->checkRights();
26        $scopeIdList = explode(',', $args['ids']);
27
28        $ticketprinterList = new \BO\Zmsentities\Collection\TicketprinterList();
29        foreach ($scopeIdList as $scopeId) {
30            $isEnabled = (new \BO\Zmsdb\Scope())->readIsEnabled($scopeId, \App::$now);
31            $entity = (new \BO\Zmsentities\Ticketprinter([
32                'enabled' => $isEnabled,
33                'buttonlist' => 's' . $scopeId
34            ]));
35            $ticketprinterList->addEntity($entity->toStructuredButtonList());
36        }
37
38        $message = Response\Message::create($request);
39        $message->data = $ticketprinterList;
40
41        $response = Render::withLastModified($response, time(), '0');
42        $response = Render::withJson($response, $message, 200);
43        return $response;
44    }
45}