Fields
GUIDs are comprised of a set of named fields, according to RFC 4122
- Full name:
\Ramsey\Uuid\Guid\Fields
- This class is marked as final and can't be subclassed
- This class implements:
\Ramsey\Uuid\Rfc4122\FieldsInterface
- This class is a Final class
See Also:
- \Ramsey\Uuid\Guid\Guid -
Properties
bytes
Methods
__construct
Parameters:
Parameter | Type | Description |
---|---|---|
$bytes |
string | A 16-byte binary string representation of a UUID |
Throws:
if the byte string is not exactly 16 bytes
if the byte string does not represent a GUID
if the byte string does not contain a valid version
getBytes
Returns the bytes that comprise the fields
getTimeLow
Returns the low field of the timestamp
getTimeMid
Returns the middle field of the timestamp
getTimeHiAndVersion
Returns the high field of the timestamp multiplexed with the version
getTimestamp
Returns the full 60-bit timestamp, without the version
getClockSeq
Returns the full 16-bit clock sequence, with the variant bits (two most significant bits) masked out
getClockSeqHiAndReserved
Returns the high field of the clock sequence multiplexed with the variant
getClockSeqLow
Returns the low field of the clock sequence
getNode
Returns the node field
getVersion
Returns the version
The version number describes how the UUID was generated and has the following meaning:
- Gregorian time UUID
- DCE security UUID
- Name-based UUID hashed with MD5
- Randomly generated UUID
- Name-based UUID hashed with SHA-1
- Reordered time UUID
- Unix Epoch time UUID
This returns null
if the UUID is not an RFC 4122 variant, since version
is only meaningful for this variant.
isCorrectVariant
Inherited methods
getVersion
Returns the version
- This method is abstract.
isMax
Returns true if the byte string represents a max UUID
isNil
Returns true if the byte string represents a nil UUID
isCorrectVersion
Returns true if the version matches one of those defined by RFC 4122
Return Value:
True if the UUID version is valid, false otherwise
getBytes
Returns the bytes that comprise the fields
- This method is abstract.
getVariant
Returns the variant identifier, according to RFC 4122, for the given bytes
The following values may be returned:
0
-- Reserved, NCS backward compatibility.2
-- The variant specified in RFC 4122.6
-- Reserved, Microsoft Corporation backward compatibility.7
-- Reserved for future definition.
Return Value:
The variant identifier, according to RFC 4122
See Also:
- https://tools.ietf.org/html/rfc4122#section-4.1.1 - RFC 4122, ยง 4.1.1: Variant
__construct
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$bytes |
string | The bytes that comprise the fields |
serialize
Returns a string representation of object
__serialize
unserialize
Constructs the object from a serialized string representation
Parameters:
Parameter | Type | Description |
---|---|---|
$data |
string | The serialized string representation of the object |
__unserialize
Parameters:
Parameter | Type | Description |
---|---|---|
$data |
array{bytes?: string} |
Automatically generated on 2025-03-18