CombGenerator
in package
implements
RandomGeneratorInterface
CombGenerator provides functionality to generate COMB (combined GUID/timestamp) sequential UUIDs
Tags
Interfaces, Classes and Traits
- RandomGeneratorInterface
- RandomGeneratorInterface provides functionality to generate strings of random binary data
Table of Contents
- TIMESTAMP_BYTES = 6
- $converter : NumberConverterInterface
- $randomGenerator : RandomGeneratorInterface
- __construct() : mixed
- Constructs a `CombGenerator` using a random-number generator and a number converter
- generate() : string
- Generates a string of binary data of the specified length
- timestamp() : string
- Returns current timestamp as integer, precise to 0.00001 seconds
Constants
TIMESTAMP_BYTES
public
mixed
TIMESTAMP_BYTES
= 6
Properties
$converter
private
NumberConverterInterface
$converter
$randomGenerator
private
RandomGeneratorInterface
$randomGenerator
Methods
__construct()
Constructs a `CombGenerator` using a random-number generator and a number converter
public
__construct(RandomGeneratorInterface $generator, NumberConverterInterface $numberConverter) : mixed
Parameters
- $generator : RandomGeneratorInterface
-
Random-number generator for the non-time part.
- $numberConverter : NumberConverterInterface
-
Instance of number converter.
Return values
mixed —generate()
Generates a string of binary data of the specified length
public
generate(int $length) : string
Parameters
- $length : int
-
The number of bytes of random binary data to generate
Tags
Return values
string —A binary string
timestamp()
Returns current timestamp as integer, precise to 0.00001 seconds
private
timestamp() : string