44 lines
1 KiB
PHP
44 lines
1 KiB
PHP
<?php
|
|
namespace Misuzu\Forum;
|
|
|
|
use Index\DateTime;
|
|
use Index\Data\IDbResult;
|
|
|
|
class ForumTopicRedirectInfo {
|
|
private string $topicId;
|
|
private ?string $userId;
|
|
private string $link;
|
|
private int $created;
|
|
|
|
public function __construct(IDbResult $result) {
|
|
$this->topicId = (string)$result->getInteger(0);
|
|
$this->userId = $result->isNull(1) ? null : (string)$result->getInteger(1);
|
|
$this->link = $result->getString(2);
|
|
$this->created = $result->getInteger(3);
|
|
}
|
|
|
|
public function getTopicId(): string {
|
|
return $this->topicId;
|
|
}
|
|
|
|
public function hasUserId(): bool {
|
|
return $this->userId !== null;
|
|
}
|
|
|
|
public function getUserId(): ?string {
|
|
return $this->userId;
|
|
}
|
|
|
|
public function getLinkTarget(): string {
|
|
return $this->link;
|
|
}
|
|
|
|
public function getCreatedTime(): int {
|
|
return $this->created;
|
|
}
|
|
|
|
public function getCreatedAt(): DateTime {
|
|
return DateTime::fromUnixTimeSeconds($this->created);
|
|
}
|
|
}
|