hanyuu/src/Users/UserBackupInfo.php
2023-10-20 22:11:43 +00:00

42 lines
1,017 B
PHP

<?php
namespace Hanyuu\Users;
use Index\DateTime;
use Index\Data\IDbResult;
class UserBackupInfo {
private string $userId;
private string $code;
private DateTime $created;
private bool $isUsed;
private DateTime $used;
public function __construct(IDbResult $result) {
$this->userId = $result->getString(0);
$this->code = $result->getString(1);
$this->created = DateTime::fromUnixTimeSeconds($result->getInteger(2));
$this->isUsed = !$result->isNull(3);
$this->used = DateTime::fromUnixTimeSeconds($result->isNull(3) ? 0 : $result->getInteger(3));
}
public function getUserId(): string {
return $this->userId;
}
public function getCode(): string {
return $this->code;
}
public function getCreatedTime(): DateTime {
return $this->created;
}
public function isUsed(): bool {
return $this->isUsed;
}
public function getUsedTime(): DateTime {
return $this->used;
}
}