PHP Class Ramsey\Uuid\UuidFactory

Inheritance: implements Ramsey\Uuid\UuidFactoryInterface
Mostrar archivo Open project: ramsey/uuid Class Usage Examples

Public Methods

Method Description
__construct ( Ramsey\Uuid\FeatureSet $features = null ) Constructs a UuidFactory for creating Ramsey\Uuid\UuidInterface instances
fromBytes ( $bytes )
fromInteger ( $integer )
fromString ( $uuid )
getCodec ( ) : Ramsey\Uuid\Codec\CodecInterface Returns the UUID coder-decoder used by this factory
getNodeProvider ( ) : Ramsey\Uuid\Provider\NodeProviderInterface Returns the system node ID provider used by this factory
getNumberConverter ( ) : Ramsey\Uuid\Converter\NumberConverterInterface Returns the number converter used by this factory
getRandomGenerator ( ) : Ramsey\Uuid\Generator\RandomGeneratorInterface Returns the random UUID generator used by this factory
getTimeGenerator ( ) : Ramsey\Uuid\Generator\TimeGeneratorInterface Returns the time-based UUID generator used by this factory
getUuidBuilder ( ) : Ramsey\Uuid\Builder\UuidBuilderInterface Returns the UUID builder this factory uses when creating Uuid instances
setCodec ( Ramsey\Uuid\Codec\CodecInterface $codec ) Sets the UUID coder-decoder used by this factory
setNumberConverter ( Ramsey\Uuid\Converter\NumberConverterInterface $converter ) Sets the number converter this factory will use
setRandomGenerator ( Ramsey\Uuid\Generator\RandomGeneratorInterface $generator ) Sets the random UUID generator this factory will use to generate version 4 UUIDs
setTimeGenerator ( Ramsey\Uuid\Generator\TimeGeneratorInterface $generator ) Sets the time-based UUID generator this factory will use to generate version 1 UUIDs
setUuidBuilder ( Ramsey\Uuid\Builder\UuidBuilderInterface $builder ) Sets the UUID builder this factory will use when creating Uuid instances
uuid ( array $fields ) : UuidInterface Returns a Uuid
uuid1 ( $node = null, $clockSeq = null )
uuid3 ( $ns, $name )
uuid4 ( )
uuid5 ( $ns, $name )

Protected Methods

Method Description
uuidFromHashedName ( string $hash, integer $version ) : UuidInterface Returns a Uuid created from $hash with the version field set to $version and the variant field set for RFC 4122
uuidFromNsAndName ( string | UuidInterface $ns, string $name, integer $version, string $hashFunction ) : UuidInterface Returns a version 3 or 5 namespaced Uuid

Method Details

__construct() public method

Constructs a UuidFactory for creating Ramsey\Uuid\UuidInterface instances
public __construct ( Ramsey\Uuid\FeatureSet $features = null )
$features Ramsey\Uuid\FeatureSet A set of features for use when creating UUIDs

fromBytes() public method

public fromBytes ( $bytes )

fromInteger() public method

public fromInteger ( $integer )

fromString() public method

public fromString ( $uuid )

getCodec() public method

Returns the UUID coder-decoder used by this factory
public getCodec ( ) : Ramsey\Uuid\Codec\CodecInterface
return Ramsey\Uuid\Codec\CodecInterface

getNodeProvider() public method

Returns the system node ID provider used by this factory
public getNodeProvider ( ) : Ramsey\Uuid\Provider\NodeProviderInterface
return Ramsey\Uuid\Provider\NodeProviderInterface

getNumberConverter() public method

Returns the number converter used by this factory
public getNumberConverter ( ) : Ramsey\Uuid\Converter\NumberConverterInterface
return Ramsey\Uuid\Converter\NumberConverterInterface

getRandomGenerator() public method

Returns the random UUID generator used by this factory
public getRandomGenerator ( ) : Ramsey\Uuid\Generator\RandomGeneratorInterface
return Ramsey\Uuid\Generator\RandomGeneratorInterface

getTimeGenerator() public method

Returns the time-based UUID generator used by this factory
public getTimeGenerator ( ) : Ramsey\Uuid\Generator\TimeGeneratorInterface
return Ramsey\Uuid\Generator\TimeGeneratorInterface

getUuidBuilder() public method

Returns the UUID builder this factory uses when creating Uuid instances
public getUuidBuilder ( ) : Ramsey\Uuid\Builder\UuidBuilderInterface
return Ramsey\Uuid\Builder\UuidBuilderInterface $builder

setCodec() public method

Sets the UUID coder-decoder used by this factory
public setCodec ( Ramsey\Uuid\Codec\CodecInterface $codec )
$codec Ramsey\Uuid\Codec\CodecInterface

setNumberConverter() public method

Sets the number converter this factory will use
public setNumberConverter ( Ramsey\Uuid\Converter\NumberConverterInterface $converter )
$converter Ramsey\Uuid\Converter\NumberConverterInterface

setRandomGenerator() public method

Sets the random UUID generator this factory will use to generate version 4 UUIDs
public setRandomGenerator ( Ramsey\Uuid\Generator\RandomGeneratorInterface $generator )
$generator Ramsey\Uuid\Generator\RandomGeneratorInterface

setTimeGenerator() public method

Sets the time-based UUID generator this factory will use to generate version 1 UUIDs
public setTimeGenerator ( Ramsey\Uuid\Generator\TimeGeneratorInterface $generator )
$generator Ramsey\Uuid\Generator\TimeGeneratorInterface

setUuidBuilder() public method

Sets the UUID builder this factory will use when creating Uuid instances
public setUuidBuilder ( Ramsey\Uuid\Builder\UuidBuilderInterface $builder )
$builder Ramsey\Uuid\Builder\UuidBuilderInterface

uuid() public method

Uses the configured builder and codec and the provided array of hexadecimal value UUID fields to construct a Uuid object.
public uuid ( array $fields ) : UuidInterface
$fields array An array of fields from which to construct a UUID; see {@see \Ramsey\Uuid\UuidInterface::getFieldsHex()} for array structure.
return UuidInterface

uuid1() public method

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

uuid3() public method

public uuid3 ( $ns, $name )

uuid4() public method

public uuid4 ( )

uuid5() public method

public uuid5 ( $ns, $name )

uuidFromHashedName() protected method

Returns a Uuid created from $hash with the version field set to $version and the variant field set for RFC 4122
protected uuidFromHashedName ( string $hash, integer $version ) : UuidInterface
$hash string The hash to use when creating the UUID
$version integer The UUID version to set for this hash (1, 3, 4, or 5)
return UuidInterface

uuidFromNsAndName() protected method

Returns a version 3 or 5 namespaced Uuid
protected uuidFromNsAndName ( string | UuidInterface $ns, string $name, integer $version, string $hashFunction ) : UuidInterface
$ns string | UuidInterface The UUID namespace to use
$name string The string to hash together with the namespace
$version integer The version of UUID to create (3 or 5)
$hashFunction string The hash function to use when hashing together the namespace and name
return UuidInterface