class OrderedTimeCodec extends StringCodec (View source)

OrderedTimeCodec optimizes the bytes to increment UUIDs when time goes by, to improve database INSERTs.

The string value will be unchanged from StringCodec. Only works for UUID type 1.

Methods

__construct(UuidBuilderInterface $builder)

Constructs a StringCodec for use encoding and decoding UUIDs

string
encode(UuidInterface $uuid)

Encodes a UuidInterface as a string representation of a UUID

string
encodeBinary(UuidInterface $uuid)

Encodes a UuidInterface as an optimized binary representation of a UUID

decode(string $encodedUuid)

Decodes a string representation of a UUID into a UuidInterface object instance

decodeBytes(string $bytes)

Decodes an optimized binary representation of a UUID into a UuidInterface object instance

getBuilder()

Returns the UUID builder

array
extractComponents(string $encodedUuid)

Returns an array of UUID components (the UUID exploded on its dashes)

array
getFields(array $components)

Returns the fields that make up this UUID

Details

__construct(UuidBuilderInterface $builder)

Constructs a StringCodec for use encoding and decoding UUIDs

Parameters

UuidBuilderInterface $builder The UUID builder to use when encoding UUIDs

string encode(UuidInterface $uuid)

Encodes a UuidInterface as a string representation of a UUID

Parameters

UuidInterface $uuid

Return Value

string Hexadecimal string representation of a UUID

string encodeBinary(UuidInterface $uuid)

Encodes a UuidInterface as an optimized binary representation of a UUID

Parameters

UuidInterface $uuid

Return Value

string Binary string representation of a UUID

UuidInterface decode(string $encodedUuid)

Decodes a string representation of a UUID into a UuidInterface object instance

Parameters

string $encodedUuid

Return Value

UuidInterface

UuidInterface decodeBytes(string $bytes)

Decodes an optimized binary representation of a UUID into a UuidInterface object instance

Parameters

string $bytes

Return Value

UuidInterface

protected UuidBuilderInterface getBuilder()

Returns the UUID builder

Return Value

UuidBuilderInterface

protected array extractComponents(string $encodedUuid)

Returns an array of UUID components (the UUID exploded on its dashes)

Parameters

string $encodedUuid

Return Value

array

protected array getFields(array $components)

Returns the fields that make up this UUID

Parameters

array $components

Return Value

array

See also

UuidInterface::getFieldsHex