service = $service; $this->user = $user; } public function getActionRead(): stdClass { return $this->getConfigData(); } /** * @throws BadRequest * @throws Forbidden * @throws Error */ public function putActionUpdate(Request $request): stdClass { if (!$this->user->isAdmin()) { throw new Forbidden(); } $data = $request->getParsedBody(); $this->service->setConfigData($data); return $this->getConfigData(); } private function getConfigData(): stdClass { $data = $this->service->getConfigData(); $metadataData = $this->service->getMetadataConfigData(); foreach (get_object_vars($metadataData) as $key => $value) { $data->$key = $value; } return $data; } }