mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-14 15:56:48 +03:00
Support version 6 UUIDs
See the following: * https://github.com/uuid6/uuid6-ietf-draft * http://gh.peabody.io/uuidv6/
This commit is contained in:
@@ -156,6 +156,17 @@ class Uuid implements UuidInterface
|
||||
*/
|
||||
public const UUID_TYPE_HASH_SHA1 = 5;
|
||||
|
||||
/**
|
||||
* Version 6 (ordered-time) UUID
|
||||
*
|
||||
* This is named `UUID_TYPE_PEABODY`, since the specification is still in
|
||||
* draft form, and the primary author/editor's name is Brad Peabody.
|
||||
*
|
||||
* @link https://github.com/uuid6/uuid6-ietf-draft UUID version 6 IETF draft
|
||||
* @link http://gh.peabody.io/uuidv6/ "Version 6" UUIDs
|
||||
*/
|
||||
public const UUID_TYPE_PEABODY = 6;
|
||||
|
||||
/**
|
||||
* DCE Security principal domain
|
||||
*
|
||||
@@ -523,4 +534,22 @@ class Uuid implements UuidInterface
|
||||
{
|
||||
return self::getFactory()->uuid5($ns, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a version 6 (ordered-time) UUID from a host ID, sequence number,
|
||||
* and the current time
|
||||
*
|
||||
* @param int|string $node A 48-bit number representing the hardware address;
|
||||
* this number may be represented as an integer or a hexadecimal string
|
||||
* @param int $clockSeq A 14-bit number used to help avoid duplicates that
|
||||
* could arise when the clock is set backwards in time or if the node ID
|
||||
* changes
|
||||
*
|
||||
* @return UuidInterface A UuidInterface instance that represents a
|
||||
* version 6 UUID
|
||||
*/
|
||||
public static function uuid6($node = null, ?int $clockSeq = null): UuidInterface
|
||||
{
|
||||
return self::getFactory()->uuid6($node, $clockSeq);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user