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

49 lines
1.1 KiB
PHP

<?php
namespace Mince;
use Index\DateTime;
use Index\Data\IDbResult;
use Ramsey\Uuid\{Uuid,UuidInterface};
class AccountLinkInfo {
public function __construct(
private string $userId,
private string $uuid,
private string $name,
private int $created
) {}
public static function fromResult(IDbResult $result): self {
return new AccountLinkInfo(
userId: $result->getString(0),
uuid: $result->getString(1),
name: $result->getString(2),
created: $result->getInteger(3),
);
}
public function getUserId(): string {
return $this->userId;
}
public function getUUIDRaw(): string {
return $this->uuid;
}
public function getUUID(): UuidInterface {
return Uuid::fromBytes($this->uuid);
}
public function getName(): string {
return $this->name;
}
public function getCreatedTime(): int {
return $this->created;
}
public function getCreatedAt(): DateTime {
return DateTime::fromUnixTimeSeconds($this->created);
}
}