Lines
100.00%
14 / 14
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| readResponse | 100.00% | 11 / 11 | 100.00% | 1 / 1 | 2 | ||
| [BO\Zmsbackend\Api\BaseController] __invoke | 100.00% | 3 / 3 | 100.00% | 1 / 1 | 1 | ||
| 15 | class OrganisationHash extends \BO\Zmsbackend\Api\BaseController | |
| 16 | { | |
| 17 | /** | |
| 18 | * @SuppressWarnings(Param) | |
| 19 | * @return \Psr\Http\Message\ResponseInterface | |
| 20 | */ | |
| 21 | #[\Override] | |
| 22 | public function readResponse( | |
| 23 | \Psr\Http\Message\RequestInterface $request, | |
| 24 | \Psr\Http\Message\ResponseInterface $response, | |
| 25 | array $args | |
| 26 | ) { | |
| 27 | \BO\Zmsbackend\Connection\Select::getWriteConnection(); | |
| 28 | $organisation = (new Query())->readEntity($args['id']); | |
| 29 | if (! $organisation) { | |
| 30 | throw new \BO\Zmsbackend\Organisation\Exception\OrganisationNotFound(); | |
| 31 | } | |
| 32 | //$ticketprinterName = Validator::param('name')->isString()->setDefault('')->getValue(); | |
| 33 | $ticketprinterName = "Ticket Printer for " . $organisation->name; | |
| 34 | $ticketprinter = (new \BO\Zmsbackend\Ticketprinter\Service\Ticketprinter())->writeEntityWithHash($organisation->id, $ticketprinterName); | |
| 35 | ||
| 36 | $message = \BO\Zmsbackend\Api\Response\Message::create($request); | |
| 37 | $message->data = $ticketprinter; | |
| 38 | ||
| 39 | $response = Render::withLastModified($response, time(), '0'); | |
| 40 | $response = Render::withJson($response, $message->setUpdatedMetaData(), $message->getStatuscode()); | |
| 41 | return $response; | |
| 42 | } | |
| 43 | } |
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 | } |