config = $config; $this->userId = $UserId; } /** * @NoAdminRequired * * @param string $key * @param string $value * @return JSONResponse */ public function set($key = '', $value = '') { $response = new JSONResponse(); if($key === '' || $value === '') { $response->setStatus(Http::STATUS_PRECONDITION_FAILED); return $response; } try { $this->config->setUserValue($this->userId, $this->appName, $key, $value); $response->setData([ 'key' => $key, 'value' => $value, ]); return $response; } catch (\Exception $e) { $response->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR); return $response; } } }