getPrimaryKey() === null) { return null; } return (int)$this->getPrimaryKey(); } public function getFingerprint(): string { return $this->getField(self::FIELD_FINGERPRINT); } public function getUserId(): int { return $this->getField(self::FIELD_USER); } public function setFingerprint(string $fingerprint): void { $this->setField(self::FIELD_FINGERPRINT, $fingerprint); } public function setUserId(int $userId): void { $this->setField(self::FIELD_USER, $userId); } public function isSharedWith(int $userId): bool { return (bool)$this->database->Count( Sharing::class, [Sharing::FIELD_USER => $this->getUserId(), Sharing::FIELD_USER_SHARED => $userId] ); } public function jsonSerialize(): array { return [ 'fingerprintId' => $this->getFingerprintId(), 'fingerprint' => $this->getFingerprint(), 'userId' => $this->getUserId() ]; } }