config = $config; } public function __invoke(ServerRequest $request): void { /** @var string|null $key */ $key = $request->getParsedBodyParam('key'); /** @var string|null $value */ $value = $request->getParsedBodyParam('value'); if (! isset($key, $value)) { $this->response->setRequestStatus(false); $this->response->addJSON(['message' => Message::error()]); return; } $result = $this->config->setUserValue(null, $key, json_decode($value)); if ($result === true) { return; } $this->response->setRequestStatus(false); $this->response->addJSON(['message' => $result]); } }