DefaultTimeGenerator
DefaultTimeGenerator generates strings of binary data based on a node ID, clock sequence, and the current time
- Full name:
\Ramsey\Uuid\Generator\DefaultTimeGenerator
- This class implements:
\Ramsey\Uuid\Generator\TimeGeneratorInterface
Properties
nodeProvider
timeConverter
timeProvider
Methods
__construct
public __construct(\Ramsey\Uuid\Provider\NodeProviderInterface $nodeProvider, \Ramsey\Uuid\Converter\TimeConverterInterface $timeConverter, \Ramsey\Uuid\Provider\TimeProviderInterface $timeProvider): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$nodeProvider |
\Ramsey\Uuid\Provider\NodeProviderInterface | |
$timeConverter |
\Ramsey\Uuid\Converter\TimeConverterInterface | |
$timeProvider |
\Ramsey\Uuid\Provider\TimeProviderInterface |
generate
Generate a binary string from a node ID, clock sequence, and current time
Parameters:
Parameter | Type | Description |
---|---|---|
$node |
mixed | A 48-bit number representing the hardware address; this number may be represented as an integer or a hexadecimal string |
$clockSeq |
?int | 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 Value:
A binary string
Throws:
if the parameters contain invalid values
if random_int() throws an exception/error
getValidNode
Uses the node provider given when constructing this instance to get the node ID (usually a MAC address)
Parameters:
Parameter | Type | Description |
---|---|---|
$node |
int|string|null | A node value that may be used to override the node provider |
Return Value:
6-byte binary string representation of the node
Throws:
Automatically generated on 2025-03-18