sharingId = (int)$this->getUrlParamInt('sharingId'); } public function handle(): void { parent::handle(); if ($this->response->getStatus() !== ServerStatus::OK) { return; } try { $sharing = new Sharing($this->sharingId); if (!$this->isUserLoggedIn() || !$this->hasUserPermission($sharing->getUserId())) { return; } $sharing->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()); } } }