<?php
namespace Symfony\Component\Uid;
class UuidV6 extends Uuid implements TimeBasedUidInterface
{
protected const TYPE = 6;
private static string $node;
public function __construct(?string $uuid = null)
{
if (null === $uuid) {
$this->uid = static::generate();
} else {
parent::__construct($uuid, true);
}
}
public function getDateTime(): \DateTimeImmutable
{
return BinaryUtil::hexToDateTime('0'.substr($this->uid, 0, 8).substr($this->uid, 9, 4).substr($this->uid, 15, 3));
}
public function getNode(): string
{
return substr($this->uid, 24);
}