Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PeclUuidNameGenerator.php

function PeclUuidNameGenerator::generate

@psalm-pure

Overrides NameGeneratorInterface::generate

File

vendor/ramsey/uuid/src/Generator/PeclUuidNameGenerator.php, line 34

Class

PeclUuidNameGenerator
PeclUuidNameGenerator generates strings of binary data from a namespace and a name, using ext-uuid

Namespace

Ramsey\Uuid\Generator

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal