userId = (int)$this->getUrlParamInt('userId'); } public function handle(): void { $this->response = new ApiJsonResponse(); try { $user = new User($this->userId); $this->response->setResult($user); } catch (Throwable $e) { $this->response->setParameter('success', false); $this->response->setStatus($e->getCode() !== 0 ? $e->getCode() : ServerStatus::INTERNAL_ERROR); $this->response->setMessage($e->getMessage()); } } }