UuidFactoryInterface
in
UuidFactoryInterface defines common functionality all `UuidFactory` instances must implement
Table of Contents
- fromBytes() : UuidInterface
- Creates a UUID from a byte string
- fromDateTime() : UuidInterface
- Creates a UUID from a DateTimeInterface instance
- fromInteger() : UuidInterface
- Creates a UUID from a 128-bit integer string
- fromString() : UuidInterface
- Creates a UUID from the string standard representation
- getValidator() : ValidatorInterface
- Returns the validator to use for the factory
- uuid1() : UuidInterface
- Returns a version 1 (time-based) UUID from a host ID, sequence number, and the current time
- uuid2() : UuidInterface
- Returns a version 2 (DCE Security) UUID from a local domain, local identifier, host ID, clock sequence, and the current time
- uuid3() : UuidInterface
- Returns a version 3 (name-based) UUID based on the MD5 hash of a namespace ID and a name
- uuid4() : UuidInterface
- Returns a version 4 (random) UUID
- uuid5() : UuidInterface
- Returns a version 5 (name-based) UUID based on the SHA-1 hash of a namespace ID and a name
- uuid6() : UuidInterface
- Returns a version 6 (ordered-time) UUID from a host ID, sequence number, and the current time
Methods
fromBytes()
Creates a UUID from a byte string
public
fromBytes(string $bytes) : UuidInterface
Parameters
- $bytes : string
-
A binary string
Tags
Return values
UuidInterface —A UuidInterface instance created from a binary string representation
fromDateTime()
Creates a UUID from a DateTimeInterface instance
public
fromDateTime(DateTimeInterface $dateTime[, Hexadecimal|null $node = null ][, int|null $clockSeq = null ]) : UuidInterface
Parameters
- $dateTime : DateTimeInterface
-
The date and time
- $node : Hexadecimal|null = null
-
A 48-bit number representing the hardware address
- $clockSeq : int|null = null
-
A 14-bit number used to help avoid duplicates that could arise when the clock is set backwards in time or if the node ID changes
Return values
UuidInterface —A UuidInterface instance that represents a version 1 UUID created from a DateTimeInterface instance
fromInteger()
Creates a UUID from a 128-bit integer string
public
fromInteger(string $integer) : UuidInterface
Parameters
- $integer : string
-
String representation of 128-bit integer
Tags
Return values
UuidInterface —A UuidInterface instance created from the string representation of a 128-bit integer
fromString()
Creates a UUID from the string standard representation
public
fromString(string $uuid) : UuidInterface
Parameters
- $uuid : string
-
A hexadecimal string
Tags
Return values
UuidInterface —A UuidInterface instance created from a hexadecimal string representation
getValidator()
Returns the validator to use for the factory
public
getValidator() : ValidatorInterface
Tags
Return values
ValidatorInterface —uuid1()
Returns a version 1 (time-based) UUID from a host ID, sequence number, and the current time
public
uuid1([Hexadecimal|int|string|null $node = null ][, int|null $clockSeq = null ]) : UuidInterface
Parameters
- $node : Hexadecimal|int|string|null = null
-
A 48-bit number representing the hardware address; this number may be represented as an integer or a hexadecimal string
- $clockSeq : int|null = null
-
A 14-bit number used to help avoid duplicates that could arise when the clock is set backwards in time or if the node ID changes
Return values
UuidInterface —A UuidInterface instance that represents a version 1 UUID
uuid2()
Returns a version 2 (DCE Security) UUID from a local domain, local identifier, host ID, clock sequence, and the current time
public
uuid2(int $localDomain[, Integer|null $localIdentifier = null ][, Hexadecimal|null $node = null ][, int|null $clockSeq = null ]) : UuidInterface
Parameters
- $localDomain : int
-
The local domain to use when generating bytes, according to DCE Security
- $localIdentifier : Integer|null = null
-
The local identifier for the given domain; this may be a UID or GID on POSIX systems, if the local domain is person or group, or it may be a site-defined identifier if the local domain is org
- $node : Hexadecimal|null = null
-
A 48-bit number representing the hardware address
- $clockSeq : int|null = null
-
A 14-bit number used to help avoid duplicates that could arise when the clock is set backwards in time or if the node ID changes
Return values
UuidInterface —A UuidInterface instance that represents a version 2 UUID
uuid3()
Returns a version 3 (name-based) UUID based on the MD5 hash of a namespace ID and a name
public
uuid3(string|UuidInterface $ns, string $name) : UuidInterface
Parameters
- $ns : string|UuidInterface
-
The namespace (must be a valid UUID)
- $name : string
-
The name to use for creating a UUID
Tags
Return values
UuidInterface —A UuidInterface instance that represents a version 3 UUID
uuid4()
Returns a version 4 (random) UUID
public
uuid4() : UuidInterface
Return values
UuidInterface —A UuidInterface instance that represents a version 4 UUID
uuid5()
Returns a version 5 (name-based) UUID based on the SHA-1 hash of a namespace ID and a name
public
uuid5(string|UuidInterface $ns, string $name) : UuidInterface
Parameters
- $ns : string|UuidInterface
-
The namespace (must be a valid UUID)
- $name : string
-
The name to use for creating a UUID
Tags
Return values
UuidInterface —A UuidInterface instance that represents a version 5 UUID
uuid6()
Returns a version 6 (ordered-time) UUID from a host ID, sequence number, and the current time
public
uuid6([Hexadecimal|null $node = null ][, int|null $clockSeq = null ]) : UuidInterface
Parameters
- $node : Hexadecimal|null = null
-
A 48-bit number representing the hardware address
- $clockSeq : int|null = null
-
A 14-bit number used to help avoid duplicates that could arise when the clock is set backwards in time or if the node ID changes
Return values
UuidInterface —A UuidInterface instance that represents a version 6 UUID