fingerprintId = (int)$this->getUrlParamInt('fingerprintId'); } public function handle(): void { if (!$this->isUserLoggedIn()) { return; } parent::handle(); $this->response = new ApiJsonResponse(); try { $fingerprint = new Fingerprint($this->fingerprintId); if ($this->hasUserPermission($fingerprint->getUserId()) || $this->handleFingerprint($fingerprint)) { return; } $this->response->setMessage('Fingerprint did not differ from the stored. Nothing changed.'); } catch (Throwable $e) { $this->response->setStatus(ServerStatus::BAD_REQUEST); $this->response->setParameter('success', false); $this->response->setMessage($e->getMessage()); } } public function handleFingerprint(Fingerprint $fingerprint): bool { if ($fingerprint->getFingerprint() !== $this->jsonBody->fingerprint) { $fingerprint->setFingerprint($this->jsonBody->fingerprint); $fingerprint->Save(); return true; } return false; } }