Class UUID
Universally unique identifier.
-
Core\Object
implements
Core\Chainable
-
Core\Set
implements
Core\Accessor
-
Core\UUID
implements
Core\Comparable,
Core\Equality,
Serializable,
Core\Storable
Namespace: Core
Package: Core
Since:
3.0
Requires:
PHP 5.3
Version:
1.1
Located at UUID.inc.php
Methods summary
public
|
#
__construct( string $uuid = null )
Initialises new UUID instance with a random UUID or a given (binary)
UUID string.
Initialises new UUID instance with a random UUID or a given (binary)
UUID string.
Parameters
- $uuid
UUID to initialise object with. Supports generic UUID strings, enclosed
GUIDs and UUID hash values (16-byte binary string).
Throws
See
UUID::hash()
UUID::gen()
Since
3.0
|
public static
string
|
#
gen( )
Returns a new random version 4 UUID string. Confer RFC 4122 for details.
Returns a new random version 4 UUID string. Confer RFC 4122 for details.
Returns
string A new random version 4 UUID string.
Link
See
Since
3.0
|
public static
string
|
#
genID( )
Returns an identifier string from a temporary UUID.
Returns an identifier string from a temporary UUID.
Returns
string Identifier string created from a temporary UUID. An identifier string
is guaranteed to start with a letter and may only contain letters,
digits and underscores.
See
Since
3.0
|
public static
string
|
#
genURN( )
Returns a new UUID URN from a random version 4 UUID.
Returns a new UUID URN from a random version 4 UUID.
Returns
string A new UUID URN string.
See
Since
3.0
|
public static
Core\UUID
|
#
unpack( string $uuid )
Returns a new UUID created from a 16-byte (128-bit) binary UUID string.
Returns a new UUID created from a 16-byte (128-bit) binary UUID string.
Parameters
- $uuid
- 16-byte binary UUID string to recover UUID from.
Returns
Since
3.1
Implementation of
|
public
string
|
#
__toString( )
Formats UUID string.
Returns
string UUID string.
Since
3.0
Overrides
|
public
boolean
|
#
compareTo( Core\UUID |string $uuid )
Compares the current UUID with another UUID instance or UUID string.
Compares the current UUID with another UUID instance or UUID string.
Parameters
- $uuid
- UUID to compare current UUID with.
Returns
boolean Returns < 0 if the current UUID is less than the given UUID; > 0 if
the current UUID is greater than the given UUID, and 0 if both are equal.
Since
3.0
Implementation of
|
public
string
|
#
hash( )
Returns the hash code of the current UUID.
Returns the hash code of the current UUID.
The hash format changed in version 1.1 from a hexadecimal representation
to a binary format. Use bin2hex() on the returned hash to retrieve a
version 1.0 hash string. The returned value equals Core\UUID::pack() .
Returns
string UUID hash value.
See
Since
3.0
Overrides
|
public
string
|
#
identifier( )
Returns an identifier string created from the current UUID.
Returns an identifier string created from the current UUID.
Returns
string Identifier string created from the current UUID. An identifier string
is guaranteed to start with a letter and may only contain letters,
digits and underscores.
Since
3.0
|
public
boolean
|
#
isEqualTo( Core\UUID |string $uuid )
Compares the current UUID with another UUID for equality.
Compares the current UUID with another UUID for equality.
Parameters
- $uuid
- UUID to compare current UUID with.
Returns
boolean Returns true , if both UUIDs are equal, otherwise false .
See
Since
3.0
Implementation of
|
public
string
|
#
pack( )
Returns the 16-byte (128-bit) binary UUID string.
Returns the 16-byte (128-bit) binary UUID string.
Returns
string Packed UUID binary.
Since
3.1
Implementation of
|
public
string
|
#
serialize( )
Returns serialized UUID string.
Returns serialized UUID string.
Returns
string Serialized UUID string.
Since
3.0
Implementation of
|
public
|
#
unserialize( string $stream )
Resets UUID internals to serialized UUID string.
Resets UUID internals to serialized UUID string.
Parameters
- $stream
- Serialized data stream to reset UUID internals with.
Since
3.0
Implementation of
|
public
string
|
#
urn( )
Returns UUID URN from current UUID.
Returns UUID URN from current UUID.
Returns
string UUID URN from current UUID.
Since
3.0
|
protected
string|boolean
|
#
_parseUUID( string $uuid )
Parses the given UUID string, enclosed GUID or UUID hash and returns a
lowercase UUID string on success, otherwise false .
Parses the given UUID string, enclosed GUID or UUID hash and returns a
lowercase UUID string on success, otherwise false .
Parameters
- $uuid
- UUID string to parse.
Returns
string|boolean UUID string on success, otherwise false .
Since
3.0
|
__autocreateFactory()
,
__call()
,
__processParameters()
,
attachMethod()
,
chain()
,
getValueForKey()
,
getValueForKeyPath()
,
getValueForUndefinedKey()
,
issetValueForKey()
,
setValueForKey()
,
setValueForKeyPath()
,
setValueForUndefinedKey()
,
uuid()
Constants summary
string |
Zero
Non-unique zero UUID.
Since
3.0
|
#
'00000000-0000-0000-0000-000000000000'
|
Properties summary
protected
string
|
$_v_uuid
UUID stored with class.
Since
3.0
|
|
Magic properties
public read-only
string
|
$uuid
|