TimestampFirstCombCodec
extends StringCodec
in package
TimestampFirstCombCodec encodes and decodes COMB UUIDs which have the timestamp as the first 48 bits.
To be used with MySQL, PostgreSQL, Oracle.
Table of Contents
- $builder : UuidBuilderInterface
- __construct() : mixed
- Constructs a StringCodec for use encoding and decoding UUIDs
- decode() : UuidInterface
- Decodes a string representation of timestamp first COMB UUID into a UuidInterface object instance
- decodeBytes() : UuidInterface
- Decodes a binary representation of timestamp first COMB UUID into a UuidInterface object instance
- encode() : string
- Encodes a UuidInterface as a string representation of a timestamp first COMB UUID
- encodeBinary() : string
- Encodes a UuidInterface as a binary representation of timestamp first COMB UUID
- extractComponents() : array<string|int, mixed>
- Returns an array of UUID components (the UUID exploded on its dashes)
- getBuilder() : UuidBuilderInterface
- Returns the UUID builder
- getFields() : array<string|int, mixed>
- Returns the fields that make up this UUID
- swapTimestampAndRandomBits() : void
- Swaps the first 48 bits with the last 48 bits
Properties
$builder
private
UuidBuilderInterface
$builder
Methods
__construct()
Constructs a StringCodec for use encoding and decoding UUIDs
public
__construct(UuidBuilderInterface $builder) : mixed
Parameters
- $builder : UuidBuilderInterface
-
The UUID builder to use when encoding UUIDs
Return values
mixed —decode()
Decodes a string representation of timestamp first COMB UUID into a UuidInterface object instance
public
decode(string $encodedUuid) : UuidInterface
Parameters
- $encodedUuid : string
Tags
Return values
UuidInterface —decodeBytes()
Decodes a binary representation of timestamp first COMB UUID into a UuidInterface object instance
public
decodeBytes(string $bytes) : UuidInterface
Parameters
- $bytes : string
Tags
Return values
UuidInterface —encode()
Encodes a UuidInterface as a string representation of a timestamp first COMB UUID
public
encode(UuidInterface $uuid) : string
Parameters
- $uuid : UuidInterface
Return values
string —Hexadecimal string representation of a GUID
encodeBinary()
Encodes a UuidInterface as a binary representation of timestamp first COMB UUID
public
encodeBinary(UuidInterface $uuid) : string
Parameters
- $uuid : UuidInterface
Return values
string —Binary string representation of timestamp first COMB UUID
extractComponents()
Returns an array of UUID components (the UUID exploded on its dashes)
protected
extractComponents(string $encodedUuid) : array<string|int, mixed>
Parameters
- $encodedUuid : string
Tags
Return values
array<string|int, mixed> —getBuilder()
Returns the UUID builder
protected
getBuilder() : UuidBuilderInterface
Return values
UuidBuilderInterface —getFields()
Returns the fields that make up this UUID
protected
getFields(array<string|int, mixed> $components) : array<string|int, mixed>
Parameters
- $components : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —swapTimestampAndRandomBits()
Swaps the first 48 bits with the last 48 bits
protected
swapTimestampAndRandomBits(array<string|int, mixed> &$components) : void
Parameters
- $components : array<string|int, mixed>
-
An array of UUID components (the UUID exploded on its dashes)