HumHub Documentation (unofficial)

UUID
in package

UUID Generator Class provides static methods for creating or validating UUIDs.

Tags
since
0.5

Table of Contents

Constants

UUID_LENGTH_MAX  = self::UUID_LENGTH_MIN + 6
UUID_LENGTH_MIN  = 8 + 4 + 4 + 4 + 12

Methods

is_valid()  : mixed
v4()  : string
Creates a v4 UUID
validate()  : string|null
Validates a given UUID and makes sure the returned value is a normalized UUID or null.

Constants

UUID_LENGTH_MAX

public mixed UUID_LENGTH_MAX = self::UUID_LENGTH_MIN + 6

UUID_LENGTH_MIN

public mixed UUID_LENGTH_MIN = 8 + 4 + 4 + 4 + 12

Methods

is_valid()

public static is_valid(mixed $uuid) : mixed
Parameters
$uuid : mixed
Tags
deprecated

since 1.15, use static::validate()

see
static::validate()
codingStandardsIgnoreStart
noinspection

PhpMissingReturnTypeInspection

noinspection

PhpUnused

v4()

Creates a v4 UUID

public static v4() : string
Tags
noinspection

PhpUnhandledExceptionInspection

noinspection

PhpDocMissingThrowsInspection

Return values
string

validate()

Validates a given UUID and makes sure the returned value is a normalized UUID or null.

public static validate(string|mixed $uuid[, bool $withDash = true ][, bool|null $caseToLower = true ][, bool|null $withCurlyBrackets = false ]) : string|null

Normalized means: with now curly brackets but with dashes: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, unless configured with additional parameters. See parameter description.

Parameters
$uuid : string|mixed
$withDash : bool = true

Dashes will be true = ensured between blocks: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (default) false = removed: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx null = untouched

$caseToLower : bool|null = true

Character chase will be true = lowercase (default) false = uppercase null = unchanged

$withCurlyBrackets : bool|null = false

Embracing curly brackets will be true = ensured: {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} false = removed: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX (default) null = untouched

Tags
since
1.15
Return values
string|null

Valid, normalized GUID or null on invalid input


        
On this page

Search results