FileAccess Orion

UuidFactory
in package
implements UuidFactoryInterface

Interfaces, Classes, Traits and Enums

UuidFactoryInterface
UuidFactoryInterface defines common functionality all `UuidFactory` instances must implement

Table of Contents

$codec  : CodecInterface
$dceSecurityGenerator  : DceSecurityGeneratorInterface
$nameGenerator  : NameGeneratorInterface
$nodeProvider  : NodeProviderInterface
$numberConverter  : NumberConverterInterface
$randomGenerator  : RandomGeneratorInterface
$timeConverter  : TimeConverterInterface
$timeGenerator  : TimeGeneratorInterface
$uuidBuilder  : UuidBuilderInterface
$validator  : ValidatorInterface
__construct()  : mixed
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
getCodec()  : CodecInterface
Returns the codec used by this factory
getDceSecurityGenerator()  : DceSecurityGeneratorInterface
Returns the DCE Security generator used by this factory
getNameGenerator()  : NameGeneratorInterface
Returns the name generator used by this factory
getNodeProvider()  : NodeProviderInterface
Returns the node provider used by this factory
getNumberConverter()  : NumberConverterInterface
Returns the number converter used by this factory
getRandomGenerator()  : RandomGeneratorInterface
Returns the random generator used by this factory
getTimeGenerator()  : TimeGeneratorInterface
Returns the time generator used by this factory
getUuidBuilder()  : UuidBuilderInterface
Returns the UUID builder used by this factory
getValidator()  : ValidatorInterface
Returns the validator to use for the factory
setCodec()  : void
Sets the codec to use for this factory
setDceSecurityGenerator()  : void
Sets the DCE Security generator to use for this factory
setNameGenerator()  : void
Sets the name generator to use for this factory
setNumberConverter()  : void
Sets the number converter to use for this factory
setRandomGenerator()  : void
Sets the random generator to use for this factory
setTimeGenerator()  : void
Sets the time generator to use for this factory
setUuidBuilder()  : void
Sets the UUID builder to use for this factory
setValidator()  : void
Sets the validator to use for this factory
uuid()  : UuidInterface
Returns a Uuid created from the provided byte string
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
uuidFromBytesAndVersion()  : UuidInterface
Returns an RFC 4122 variant Uuid, created from the provided bytes and version
uuidFromNsAndName()  : UuidInterface
Returns a version 3 or 5 namespaced Uuid

Properties

Methods

__construct()

public __construct([FeatureSet $features = null ]) : mixed
Parameters
$features : FeatureSet = null

A set of available features in the current environment

Return values
mixed

fromBytes()

Creates a UUID from a byte string

public fromBytes(string $bytes) : UuidInterface
Parameters
$bytes : string

A binary string

Tags
psalm-pure
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
psalm-pure
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
psalm-pure
Return values
UuidInterface

A UuidInterface instance created from a hexadecimal string representation

setNameGenerator()

Sets the name generator to use for this factory

public setNameGenerator(NameGeneratorInterface $nameGenerator) : void
Parameters
$nameGenerator : NameGeneratorInterface

A generator to generate binary data, based on a namespace and name

Return values
void

setNumberConverter()

Sets the number converter to use for this factory

public setNumberConverter(NumberConverterInterface $converter) : void
Parameters
$converter : NumberConverterInterface

A converter to use for working with large integers (i.e. integers greater than PHP_INT_MAX)

Return values
void

setValidator()

Sets the validator to use for this factory

public setValidator(ValidatorInterface $validator) : void
Parameters
$validator : ValidatorInterface

A validator to use for validating whether a string is a valid UUID

Return values
void

uuid()

Returns a Uuid created from the provided byte string

public uuid(string $bytes) : UuidInterface

Uses the configured builder and codec and the provided byte string to construct a Uuid object.

Parameters
$bytes : string

The byte string from which to construct a UUID

Tags
psalm-pure
Return values
UuidInterface

An instance of UuidInterface, created from the provided bytes

uuid1()

Returns a version 1 (time-based) UUID from a host ID, sequence number, and the current time

public uuid1([mixed $node = null ][, int|null $clockSeq = null ]) : UuidInterface
Parameters
$node : mixed = 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

Tags
inheritDoc
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(mixed $ns, string $name) : UuidInterface
Parameters
$ns : mixed

The namespace (must be a valid UUID)

$name : string

The name to use for creating a UUID

Tags
inheritDoc
psalm-pure
Return values
UuidInterface

A UuidInterface instance that represents a version 3 UUID

uuid5()

Returns a version 5 (name-based) UUID based on the SHA-1 hash of a namespace ID and a name

public uuid5(mixed $ns, string $name) : UuidInterface
Parameters
$ns : mixed

The namespace (must be a valid UUID)

$name : string

The name to use for creating a UUID

Tags
inheritDoc
psalm-pure
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

uuidFromBytesAndVersion()

Returns an RFC 4122 variant Uuid, created from the provided bytes and version

private uuidFromBytesAndVersion(string $bytes, int $version) : UuidInterface
Parameters
$bytes : string

The byte string to convert to a UUID

$version : int

The RFC 4122 version to apply to the UUID

Tags
psalm-pure
Return values
UuidInterface

An instance of UuidInterface, created from the byte string and version

uuidFromNsAndName()

Returns a version 3 or 5 namespaced Uuid

private uuidFromNsAndName(string|UuidInterface $ns, string $name, int $version, string $hashAlgorithm) : UuidInterface
Parameters
$ns : string|UuidInterface

The namespace (must be a valid UUID)

$name : string

The name to hash together with the namespace

$version : int

The version of UUID to create (3 or 5)

$hashAlgorithm : string

The hashing algorithm to use when hashing together the namespace and name

Tags
psalm-pure
Return values
UuidInterface

An instance of UuidInterface, created by hashing together the provided namespace and name

Search results