makeJSONResponse(fn () => $this->appSettings->getAll()); } #[NoAdminRequired] public function set(string $folderVariant, string $buttonVariant): JSONResponse { $this->appSettings->set($folderVariant, $buttonVariant); return $this->makeJSONResponse(fn () => $this->appSettings->getAll()); } protected function makeJSONResponse(Closure $closure): JSONResponse { try { return new JSONResponse($closure(), HTTP::STATUS_OK); } catch (Exception $e) { return new JSONResponse(['message' => $e->getMessage()], HTTP::INTERNAL_SERVER_ERROR); } } }