StringCodec
in package
implements
CodecInterface
StringCodec encodes and decodes RFC 4122 UUIDs
Tags
Interfaces, Classes and Traits
- CodecInterface
- CodecInterface represents a UUID coder-decoder
Table of Contents
- $builder : UuidBuilderInterface
- __construct() : mixed
- Constructs a StringCodec for use encoding and decoding UUIDs
- decode() : UuidInterface
- Decodes a string representation of a UUID into a UuidInterface object instance
- decodeBytes() : UuidInterface
- Decodes a binary representation of a UUID into a UuidInterface object instance
- encode() : string
- Encodes a UuidInterface as a string representation of a UUID
- encodeBinary() : string
- Encodes a UuidInterface as a binary representation of a 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
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 a UUID into a UuidInterface object instance
public
decode(string $encodedUuid) : UuidInterface
Parameters
- $encodedUuid : string
Tags
Return values
UuidInterface —decodeBytes()
Decodes a binary representation of a 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 UUID
public
encode(UuidInterface $uuid) : string
Parameters
- $uuid : UuidInterface
Return values
string —Hexadecimal string representation of a UUID
encodeBinary()
Encodes a UuidInterface as a binary representation of a UUID
public
encodeBinary(UuidInterface $uuid) : string
Parameters
- $uuid : UuidInterface
Return values
string —Binary string representation of a 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>