class PeclUuidNameGenerator
PeclUuidNameGenerator generates strings of binary data from a namespace and a name, using ext-uuid
@link https://pecl.php.net/package/uuid ext-uuid
Hierarchy
- class \Ramsey\Uuid\Generator\PeclUuidNameGenerator implements \Ramsey\Uuid\Generator\NameGeneratorInterface
Expanded class hierarchy of PeclUuidNameGenerator
1 file declares its use of PeclUuidNameGenerator
- FeatureSet.php in vendor/
ramsey/ uuid/ src/ FeatureSet.php
File
-
vendor/
ramsey/ uuid/ src/ Generator/ PeclUuidNameGenerator.php, line 31
Namespace
Ramsey\Uuid\GeneratorView source
class PeclUuidNameGenerator implements NameGeneratorInterface {
/** @psalm-pure */
public function generate(UuidInterface $ns, string $name, string $hashAlgorithm) : string {
$uuid = match ($hashAlgorithm) { 'md5' => uuid_generate_md5($ns->toString(), $name),
'sha1' => uuid_generate_sha1($ns->toString(), $name),
default => throw new NameException(sprintf('Unable to hash namespace and name with algorithm \'%s\'', $hashAlgorithm)),
};
return uuid_parse($uuid);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
PeclUuidNameGenerator::generate | public | function | @psalm-pure | Overrides NameGeneratorInterface::generate |