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
$nodeProvider
private
NodeProviderInterface
$nodeProvider
$timeConverter
private
TimeConverterInterface
$timeConverter
$timeProvider
private
TimeProviderInterface
$timeProvider
Methods
__construct()
public
__construct(NodeProviderInterface $nodeProvider, TimeConverterInterface $timeConverter, TimeProviderInterface $timeProvider) : mixed
Parameters
- $nodeProvider : NodeProviderInterface
- $timeConverter : TimeConverterInterface
- $timeProvider : TimeProviderInterface
Return values
mixed —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
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
Return values
string —6-byte binary string representation of the node