class UuidGenerator extends AbstractIdGenerator (View source)

Generates UUIDs.

Properties

protected string $salt A unique environment value to salt each UUID with.

Methods

mixed
generate(DocumentManager $dm, $document)

Generates a new UUID

setSalt(string $salt)

Used to set the salt that will be applied to each id

string
getSalt()

Returns the current salt value

bool
isValid(string $uuid)

Checks that a given string is a valid uuid.

string
generateV4()

Generates a v4 UUID

string
generateV5(string $namespace, string $salt)

Generates a v5 UUID

Details

mixed generate(DocumentManager $dm, $document)

Generates a new UUID

Parameters

DocumentManager $dm
$document

Return Value

mixed

setSalt(string $salt)

Used to set the salt that will be applied to each id

Parameters

string $salt The sale to use

string getSalt()

Returns the current salt value

Return Value

string $salt The current salt

bool isValid(string $uuid)

Checks that a given string is a valid uuid.

Parameters

string $uuid The string to check.

Return Value

bool

string generateV4()

Generates a v4 UUID

Return Value

string

string generateV5(string $namespace, string $salt)

Generates a v5 UUID

Parameters

string $namespace The UUID to seed with
string $salt The string to salt this new UUID with

Return Value

string

Exceptions

Exception When the provided namespace is invalid.