Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| GetSystemSettingsAction | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| __invoke | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace App\Action\SuperAdmin; |
| 6 | |
| 7 | use App\Domain\ErrorLog\Service\ErrorLogService; |
| 8 | use App\Domain\SystemSettings\Service\SystemSettingsService; |
| 9 | use App\Renderer\JsonRenderer; |
| 10 | use Psr\Http\Message\ResponseInterface; |
| 11 | use Psr\Http\Message\ServerRequestInterface; |
| 12 | |
| 13 | /** |
| 14 | * Get all system settings. |
| 15 | */ |
| 16 | final readonly class GetSystemSettingsAction |
| 17 | { |
| 18 | private SystemSettingsService $settingsService; |
| 19 | |
| 20 | private JsonRenderer $renderer; |
| 21 | |
| 22 | public function __construct(SystemSettingsService $settingsService, JsonRenderer $renderer) |
| 23 | { |
| 24 | $this->settingsService = $settingsService; |
| 25 | $this->renderer = $renderer; |
| 26 | } |
| 27 | |
| 28 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface |
| 29 | { |
| 30 | $settings = $this->settingsService->getAll(); |
| 31 | |
| 32 | return $this->renderer->json($response, [ |
| 33 | 'success' => true, |
| 34 | 'data' => [ |
| 35 | 'settings' => $settings, |
| 36 | 'logLevels' => ErrorLogService::LOG_LEVELS, |
| 37 | ], |
| 38 | ]); |
| 39 | } |
| 40 | } |