mince/src/SkinInfo.php
2024-02-21 16:08:45 +00:00

48 lines
1 KiB
PHP

<?php
namespace Mince;
use Index\DateTime;
use Index\Data\IDbResult;
class SkinInfo {
public function __construct(
private string $userId,
private string $hash,
private string $model,
private int $updated,
) {}
public static function fromResult(IDbResult $result): self {
return new SkinInfo(
userId: $result->getString(0),
hash: $result->getString(1),
model: $result->getString(2),
updated: $result->getInteger(3),
);
}
public function getUserId(): string {
return $this->userId;
}
public function getHash(): string {
return $this->hash;
}
public function getModel(): string {
return $this->model;
}
public function isClassic(): bool {
return $this->model === 'classic';
}
public function getUpdatedTime(): int {
return $this->updated;
}
public function getUpdatedAt(): DateTime {
return DateTime::fromUnixTimeSeconds($this->updated);
}
}