userId = (int)$this->getUrlParamInt('userId'); } public function handle(): void { if (!$this->isUserLoggedIn()) { return; } parent::handle(); if ($this->response->getStatus() !== ServerStatus::OK || !$this->hasUserPermission($this->userId)) { return; } try { $user = new User($this->userId); $user->Delete(); $this->response = new ApiJsonResponse(); $this->response->setParameter('success', true); } catch (Throwable $e) { $this->response = new ApiJsonResponse(ServerStatus::BAD_REQUEST); $this->response->setParameter('success', false); $this->response->setMessage($e->getMessage()); } } }