39 lines
1 KiB
PHP
39 lines
1 KiB
PHP
<?php
|
|
namespace Misuzu\Users;
|
|
|
|
use Index\DateTime;
|
|
use Index\Colour\Colour;
|
|
|
|
abstract class UserInfo {
|
|
abstract public function getId(): string;
|
|
abstract public function getName(): string;
|
|
abstract public function getCountryCode(): string;
|
|
|
|
abstract public function isGuest(): bool;
|
|
abstract public function isSystem(): bool;
|
|
abstract public function isSuper(): bool;
|
|
|
|
abstract public function getDisplayRoleId(): string;
|
|
|
|
abstract public function getColour(): Colour;
|
|
|
|
abstract public function getCreatedDate(): DateTime;
|
|
abstract public function getLastActiveDate(): DateTime;
|
|
abstract public function getDeletedDate(): DateTime;
|
|
|
|
public function hasColour(): bool {
|
|
return !$this->getColour()->shouldInherit();
|
|
}
|
|
|
|
private static DateTime $epoch;
|
|
public function isDeleted(): bool {
|
|
return self::$epoch->diff($this->getDeletedDate())->totalSeconds() > 0;
|
|
}
|
|
|
|
public static function init(): void {
|
|
self::$epoch = DateTime::fromUnixTimeSeconds(0);
|
|
}
|
|
}
|
|
|
|
UserInfo::init();
|