true, 'data' => [ 'settings' => $this->configService->getPublicSettings(), ], ]); } #[AdminRequired] public function save(): DataResponse { try { $settings = $this->configService->saveFromArray($this->readJsonPayload()); } catch (\InvalidArgumentException|\RuntimeException $e) { return new DataResponse([ 'ok' => false, 'error' => $e->getMessage(), ], Http::STATUS_BAD_REQUEST); } catch (\Throwable $e) { return new DataResponse([ 'ok' => false, 'error' => $this->l->t('Failed to save NuQloud Scrum settings.'), ], Http::STATUS_BAD_REQUEST); } return new DataResponse([ 'ok' => true, 'data' => [ 'settings' => $settings, ], ]); } /** @return array */ private function readJsonPayload(): array { $content = $this->request->getContent(); if (!is_string($content) || trim($content) === '') { return []; } try { $decoded = json_decode($content, true, 512, JSON_THROW_ON_ERROR); } catch (\Throwable) { return []; } return is_array($decoded) ? $decoded : []; } }