\CryptoManana\Core\Traits\RandomnessIdentifierOutputTrait

Trait IdentifierOutputTrait - Reusable implementation of `IdentifierOutputInterface`.

Summary

Methods
Properties
Constants
getGloballyUniqueId()
getStrongUniqueId()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

getGloballyUniqueId()

getGloballyUniqueId(string  $prefix = '', boolean  $withDashes = true, boolean  $upperCase = false) : string

Generate a random version 4 Globally Unique Identifier (GUID) standard string.

Note: The identifier string uses 32 alphanumeric characters and 4 hyphens (optional).

Parameters

string $prefix

Optional prefix for output strings (default => '').

boolean $withDashes

Flag for using dashes format (default => true).

boolean $upperCase

Flag for using uppercase format (default => false).

Throws

\Exception

Validation errors.

Returns

string —

Randomly generated GUID string representing a 128-bit number.

getStrongUniqueId()

getStrongUniqueId(string  $prefix = '', boolean  $alphaNumeric = false) : string

Generate a strong Universally Unique Identifier (UUID) string in hexadecimal or alphanumeric format.

Note: The identifier string is exactly 128 characters long.

Parameters

string $prefix

Optional prefix for output strings (default => '').

boolean $alphaNumeric

Flag for switching to alphanumerical format (default => false).

Throws

\Exception

Validation errors.

Returns

string —

Randomly generated strong hexadecimal/alphanumerical UUID string.