function UuidV6::fromUuidV1
Converts a version 1 UUID into an instance of a version 6 UUID
File
-
vendor/
ramsey/ uuid/ src/ Nonstandard/ UuidV6.php, line 91
Class
- UuidV6
- Reordered time, or version 6, UUIDs include timestamp, clock sequence, and node values that are combined into a 128-bit unsigned integer
Namespace
Ramsey\Uuid\NonstandardCode
public static function fromUuidV1(UuidV1 $uuidV1) : \Ramsey\Uuid\Rfc4122\UuidV6 {
$hex = $uuidV1->getHex()
->toString();
$hex = substr($hex, 13, 3) . substr($hex, 8, 4) . substr($hex, 0, 5) . '6' . substr($hex, 5, 3) . substr($hex, 16);
/** @var LazyUuidFromString $uuid */
$uuid = Uuid::fromBytes((string) hex2bin($hex));
return $uuid->toUuidV6();
}