Fields
Nonstandard UUID fields do not conform to the RFC 4122 standard
Since some systems may create nonstandard UUIDs, this implements the Rfc4122\FieldsInterface, so that functionality of a nonstandard UUID is not degraded, in the event these UUIDs are expected to contain RFC 4122 fields.
Internally, this class represents the fields together as a 16-byte binary string.
- Full name:
\Ramsey\Uuid\Nonstandard\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
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
getBytes
Returns the bytes that comprise the fields
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
getTimeHiAndVersion
Returns the high field of the timestamp multiplexed with the version
getTimeLow
Returns the low field of the timestamp
getTimeMid
Returns the middle field of the timestamp
getTimestamp
Returns the full 60-bit timestamp, without the version
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.
isNil
Returns true if these fields represent a nil UUID
The nil UUID is special form of UUID that is specified to have all 128 bits set to zero.
isMax
Inherited methods
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