class UuidFactory implements UuidFactoryInterface (View source)

Methods

__construct(FeatureSet $features = null)

Create a new a instance

getCodec()

No description

getNodeProvider()

No description

getRandomGenerator()

No description

getTimeGenerator()

No description

setTimeGenerator(TimeGeneratorInterface $generator)

No description

getNumberConverter()

No description

setRandomGenerator(RandomGeneratorInterface $generator)

No description

setNumberConverter(NumberConverterInterface $converter)

No description

setUuidBuilder(UuidBuilderInterface $builder)

No description

fromBytes($bytes)

Creates a UUID from a byte string.

fromString($name)

Creates a UUID from the string standard representation as described in the toString() method.

fromInteger($integer)

No description

uuid1($node = null, $clockSeq = null)

Generate a version 1 UUID from a host ID, sequence number, and the current time.

uuid3($ns, $name)

Generate a version 3 UUID based on the MD5 hash of a namespace identifier (which is a UUID) and a name (which is a string).

uuid4()

Generate a version 4 (random) UUID.

uuid5($ns, $name)

Generate a version 5 UUID based on the SHA-1 hash of a namespace identifier (which is a UUID) and a name (which is a string).

uuid(array $fields)

No description

uuidFromNsAndName($ns, $name, $version, $hashFunction)

No description

uuidFromHashedName(string $hash, int $version)

Returns a version 3 or 5 UUID based on the hash (md5 or sha1) of a namespace identifier (which is a UUID) and a name (which is a string)

Details

__construct(FeatureSet $features = null)

Create a new a instance

Parameters

FeatureSet $features

getCodec()

getNodeProvider()

getRandomGenerator()

getTimeGenerator()

setTimeGenerator(TimeGeneratorInterface $generator)

Parameters

TimeGeneratorInterface $generator

getNumberConverter()

setRandomGenerator(RandomGeneratorInterface $generator)

Parameters

RandomGeneratorInterface $generator

setNumberConverter(NumberConverterInterface $converter)

Parameters

NumberConverterInterface $converter

setUuidBuilder(UuidBuilderInterface $builder)

Parameters

UuidBuilderInterface $builder

fromBytes($bytes)

Creates a UUID from a byte string.

Parameters

$bytes

Exceptions

InvalidArgumentException If the $bytes string does not contain 16 characters

fromString($name)

Creates a UUID from the string standard representation as described in the toString() method.

Parameters

$name

Exceptions

InvalidArgumentException If the $name isn't a valid UUID

fromInteger($integer)

Parameters

$integer

uuid1($node = null, $clockSeq = null)

Generate a version 1 UUID from a host ID, sequence number, and the current time.

If $node is not given, we will attempt to obtain the local hardware address. If $clockSeq is given, it is used as the sequence number; otherwise a random 14-bit sequence number is chosen.

Parameters

$node
$clockSeq

Exceptions

InvalidArgumentException if the $node is invalid

uuid3($ns, $name)

Generate a version 3 UUID based on the MD5 hash of a namespace identifier (which is a UUID) and a name (which is a string).

Parameters

$ns
$name

uuid4()

Generate a version 4 (random) UUID.

uuid5($ns, $name)

Generate a version 5 UUID based on the SHA-1 hash of a namespace identifier (which is a UUID) and a name (which is a string).

Parameters

$ns
$name

uuid(array $fields)

Parameters

array $fields

protected uuidFromNsAndName($ns, $name, $version, $hashFunction)

Parameters

$ns
$name
$version
$hashFunction

protected Uuid uuidFromHashedName(string $hash, int $version)

Returns a version 3 or 5 UUID based on the hash (md5 or sha1) of a namespace identifier (which is a UUID) and a name (which is a string)

Parameters

string $hash The hash to use when creating the UUID
int $version The UUID version to be generated

Return Value

Uuid