Documentation

DefaultTimeGenerator
in package
implements TimeGeneratorInterface

DefaultTimeGenerator generates strings of binary data based on a node ID, clock sequence, and the current time

Interfaces, Classes, Traits and Enums

TimeGeneratorInterface
A time generator generates strings of binary data based on a node ID, clock sequence, and the current time

Table of Contents

$nodeProvider  : NodeProviderInterface
$timeConverter  : TimeConverterInterface
$timeProvider  : TimeProviderInterface
__construct()  : mixed
generate()  : string
Generate a binary string from a node ID, clock sequence, and current time
getValidNode()  : string
Uses the node provider given when constructing this instance to get the node ID (usually a MAC address)

Properties

Methods

generate()

Generate a binary string from a node ID, clock sequence, and current time

public generate([mixed $node = null ][, int|null $clockSeq = null ]) : string
Parameters
$node : mixed = null

A 48-bit number representing the hardware address; this number may be represented as an integer or a hexadecimal string

$clockSeq : int|null = null

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

Tags
throws
InvalidArgumentException

if the parameters contain invalid values

throws
RandomSourceException

if random_int() throws an exception/error

inheritDoc
Return values
string

A binary string

getValidNode()

Uses the node provider given when constructing this instance to get the node ID (usually a MAC address)

private getValidNode(string|int|null $node) : string
Parameters
$node : string|int|null

A node value that may be used to override the node provider

Tags
throws
InvalidArgumentException
Return values
string

6-byte binary string representation of the node

Search results