Lines
0.00%
0 / 18
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| MailTemplateCreateCustomization | 0.00% | 0 / 18 | 0.00% | 0 / 1 | 12 | 0.00% | 0 / 1 | |||
| readResponse | 0.00% | 0 / 18 | 0.00% | 0 / 1 | 12 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | /** | |
| 4 | * @package Zmsadmin | |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG | |
| 6 | **/ | |
| 7 | ||
| 8 | namespace BO\Zmsadmin\Helper; | |
| 9 | ||
| 10 | use BO\Zmsadmin\BaseController; | |
| 11 | ||
| 12 | class MailTemplateCreateCustomization extends BaseController | |
| 13 | { | |
| 14 | /** | |
| 15 | * @SuppressWarnings(Param) | |
| 16 | * @return \Psr\Http\Message\ResponseInterface | |
| 17 | */ | |
| 18 | #[\Override] | |
| 19 | public function readResponse( | |
| 20 | \Psr\Http\Message\RequestInterface $request, | |
| 21 | \Psr\Http\Message\ResponseInterface $response, | |
| 22 | array $args | |
| 23 | ) { | |
| 24 | $validator = $request->getAttribute('validator'); | |
| 25 | $input = $validator->getInput()->isJson()->getValue(); | |
| 26 | ||
| 27 | $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 1])->getEntity(); | |
| 28 | $providerId = $workstation->scope['provider']['id']; | |
| 29 | ||
| 30 | if (isset($args['id']) && !empty($args['id'])) { | |
| 31 | $scope = \App::$http | |
| 32 | ->readGetResult('/scope/' . $args['id'] . '/', ['resolveReferences' => 1]) | |
| 33 | ->getEntity(); | |
| 34 | ||
| 35 | $providerId = $scope->provider->id; | |
| 36 | } | |
| 37 | ||
| 38 | $template = \App::$http->readPostResult('/mailtemplates-create-customization/', array( | |
| 39 | "providerId" => $providerId, | |
| 40 | "templateName" => $input['templateName'], | |
| 41 | "templateContent" => $input['templateContent'] | |
| 42 | ))->getEntity(); | |
| 43 | ||
| 44 | return \BO\Slim\Render::withJson( | |
| 45 | $response, | |
| 46 | $template | |
| 47 | ); | |
| 48 | } | |
| 49 | } |