Lines
100.00%
16 / 16
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| readResponse | 100.00% | 13 / 13 | 100.00% | 1 / 1 | 2 | ||
| [BO\Zmsbackend\Api\BaseController] __invoke | 100.00% | 3 / 3 | 100.00% | 1 / 1 | 1 | ||
| 20 | class Ticketprinter extends \BO\Zmsbackend\Api\BaseController | |
| 21 | { | |
| 22 | /** | |
| 23 | * @SuppressWarnings(Param) | |
| 24 | * @return \Psr\Http\Message\ResponseInterface | |
| 25 | */ | |
| 26 | #[\Override] | |
| 27 | public function readResponse( | |
| 28 | \Psr\Http\Message\RequestInterface $request, | |
| 29 | \Psr\Http\Message\ResponseInterface $response, | |
| 30 | array $args | |
| 31 | ) { | |
| 32 | \BO\Zmsbackend\Connection\Select::setCriticalReadSession(); | |
| 33 | ||
| 34 | $input = Validator::input()->isJson()->assertValid()->getValue(); | |
| 35 | $entity = new Entity($input); | |
| 36 | $entity->testValid(); | |
| 37 | ||
| 38 | if (! $entity->toProperty()->buttons->isAvailable()) { | |
| 39 | $entity = $entity->toStructuredButtonList(); | |
| 40 | } | |
| 41 | ||
| 42 | $ticketprinter = (new Query())->readByButtonList($entity, \App::$now); | |
| 43 | \BO\Zmsbackend\Helper\TicketprinterAccess::testTicketprinter($ticketprinter); | |
| 44 | ||
| 45 | $message = \BO\Zmsbackend\Api\Response\Message::create($request); | |
| 46 | $message->data = $ticketprinter; | |
| 47 | ||
| 48 | $response = Render::withLastModified($response, time(), '0'); | |
| 49 | $response = Render::withJson($response, $message->setUpdatedMetaData(), $message->getStatuscode()); | |
| 50 | return $response; | |
| 51 | } | |
| 52 | } |
Inherited from BO\Zmsbackend\Api\BaseController
| 20 | public function __invoke(RequestInterface $request, ResponseInterface $response, array $args) | |
| 21 | { | |
| 22 | $request = $this->initRequest($request); | |
| 23 | $noCacheResponse = \BO\Slim\Render::withLastModified($response, time(), '0'); | |
| 24 | return $this->readResponse($request, $noCacheResponse, $args); | |
| 25 | } |