id = $result->getString(0); $this->userId = $result->getStringOrNull(1); $this->appId = $result->getStringOrNull(2); $this->hash = $result->getString(3); $this->remoteAddr = $result->getString(4); $this->created = $result->getInteger(5); $this->accessed = $result->getIntegerOrNull(6); $this->expires = $result->getIntegerOrNull(7); $this->deleted = $result->getIntegerOrNull(8); $this->bump = $result->getInteger(9); $this->name = $result->getString(10); $this->type = $result->getString(11); $this->size = $result->getInteger(12); } public function getId(): string { return $this->id; } public function hasUserId(): bool { return $this->userId !== null; } public function getUserId(): ?string { return $this->userId; } public function hasAppId(): bool { return $this->appId !== null; } public function getAppId(): ?string { return $this->appId; } public function getHashString(): string { return $this->hash; } public function getRemoteAddressRaw(): string { return $this->remoteAddr; } public function getRemoteAddress(): IPAddress { return IPAddress::parse($this->remoteAddr); } public function getCreatedTime(): int { return $this->created; } public function getCreatedAt(): DateTime { return DateTime::fromUnixTimeSeconds($this->created); } public function hasBeenAccessed(): bool { return $this->accessed !== null; } public function getAccessedTime(): ?int { return $this->accessed; } public function getAccessedAt(): ?DateTime { return $this->accessed === null ? null : DateTime::fromUnixTimeSeconds($this->accessed); } public function hasExpiryTime(): bool { return $this->expires !== null; } public function hasExpired(): bool { return $this->expires !== null && $this->expires <= time(); } public function getExpiredTime(): ?int { return $this->expires; } public function getExpiredAt(): ?DateTime { return $this->expires === null ? null : DateTime::fromUnixTimeSeconds($this->expires); } public function isDeleted(): bool { return $this->deleted !== null; } public function getDeletedTime(): ?int { return $this->deleted; } public function getDeletedAt(): ?DateTime { return $this->deleted === null ? null : DateTime::fromUnixTimeSeconds($this->deleted); } public function getBumpAmount(): int { return $this->bump; } public function getName(): string { return $this->name; } public function getMediaTypeString(): string { return $this->type; } public function getMediaType(): MediaType { return MediaType::parse($this->type); } public function isImage(): bool { return str_starts_with($this->type, 'image/'); } public function isVideo(): bool { return str_starts_with($this->type, 'video/'); } public function isAudio(): bool { return str_starts_with($this->type, 'audio/'); } public function getDataSize(): int { return $this->size; } }