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, object $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

isValid(string $uuid)

Checks that a given string is a valid uuid.

generateV4()

Generates a v4 UUID

generateV5(string $namespace, string $salt)

Generates a v5 UUID

Details

mixed generate(DocumentManager $dm, object $document)

Generates a new UUID

Parameters

DocumentManager $dm
object $document

Return Value

mixed

Exceptions

Exception

setSalt(string $salt)

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

Parameters

string $salt

string getSalt()

Returns the current salt value

Return Value

string $salt The current salt

isValid(string $uuid)

Checks that a given string is a valid uuid.

Parameters

string $uuid

generateV4()

Generates a v4 UUID

generateV5(string $namespace, string $salt)

Generates a v5 UUID

Parameters

string $namespace
string $salt

Exceptions

Exception When the provided namespace is invalid.