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

Breadcrumb

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

function UuidFactory::uuidFromNsAndName

Returns a version 3 or 5 namespaced Uuid

@psalm-pure

Parameters

string|UuidInterface $ns The namespace (must be a valid UUID):

string $name The name to hash together with the namespace:

int $version The version of UUID to create (3 or 5):

string $hashAlgorithm The hashing algorithm to use when hashing: together the namespace and name

Return value

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

2 calls to UuidFactory::uuidFromNsAndName()
UuidFactory::uuid3 in vendor/ramsey/uuid/src/UuidFactory.php
@inheritDoc @psalm-pure
UuidFactory::uuid5 in vendor/ramsey/uuid/src/UuidFactory.php
@inheritDoc @psalm-pure

File

vendor/ramsey/uuid/src/UuidFactory.php, line 465

Class

UuidFactory

Namespace

Ramsey\Uuid

Code

private function uuidFromNsAndName(UuidInterface|string $ns, string $name, int $version, string $hashAlgorithm) : UuidInterface {
    if (!$ns instanceof UuidInterface) {
        $ns = $this->fromString($ns);
    }
    $bytes = $this->nameGenerator
        ->generate($ns, $name, $hashAlgorithm);
    return $this->uuidFromBytesAndVersion(substr($bytes, 0, 16), $version);
}

API Navigation

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