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

Breadcrumb

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

function UuidV6::fromUuidV1

Converts a version 1 UUID into an instance of a version 6 UUID

File

vendor/ramsey/uuid/src/Nonstandard/UuidV6.php, line 91

Class

UuidV6
Reordered time, or version 6, UUIDs include timestamp, clock sequence, and node values that are combined into a 128-bit unsigned integer

Namespace

Ramsey\Uuid\Nonstandard

Code

public static function fromUuidV1(UuidV1 $uuidV1) : \Ramsey\Uuid\Rfc4122\UuidV6 {
    $hex = $uuidV1->getHex()
        ->toString();
    $hex = substr($hex, 13, 3) . substr($hex, 8, 4) . substr($hex, 0, 5) . '6' . substr($hex, 5, 3) . substr($hex, 16);
    
    /** @var LazyUuidFromString $uuid */
    $uuid = Uuid::fromBytes((string) hex2bin($hex));
    return $uuid->toUuidV6();
}

API Navigation

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