class DefaultTimeGenerator implements TimeGeneratorInterface (View source)

Methods

__construct(NodeProviderInterface $nodeProvider, TimeConverterInterface $timeConverter, TimeProviderInterface $timeProvider)

No description

string
generate(int|string $node = null, int $clockSeq = null)

Generate a version 1 UUID from a host ID, sequence number, and the current time.

getValidNode($node)

No description

Details

__construct(NodeProviderInterface $nodeProvider, TimeConverterInterface $timeConverter, TimeProviderInterface $timeProvider)

Parameters

NodeProviderInterface $nodeProvider
TimeConverterInterface $timeConverter
TimeProviderInterface $timeProvider

string generate(int|string $node = null, int $clockSeq = null)

Generate a version 1 UUID from a host ID, sequence number, and the current time.

If $node is not given, we will attempt to obtain the local hardware address. If $clockSeq is given, it is used as the sequence number; otherwise a random 14-bit sequence number is chosen.

Parameters

int|string $node A 48-bit number representing the hardware address This number may be represented as an integer or a hexadecimal string.
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 Value

string A 16-byte binary string representing a UUID

protected getValidNode($node)

Parameters

$node