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

Breadcrumb

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

function Uuid::fromString

Creates a UUID from the string standard representation

@psalm-pure note: changing the internal factory is an edge case not covered by purity invariants, but under constant factory setups, this method operates in functionally pure manners

@psalm-suppress ImpureStaticProperty we know that the factory being replaced can lead to massive havoc across all consumers: that should never happen, and is generally to be discouraged. Until the factory is kept un-replaced, this method is effectively pure.

Parameters

string $uuid A hexadecimal string:

Return value

UuidInterface A UuidInterface instance created from a hexadecimal string representation

1 call to Uuid::fromString()
Uuid::fromBytes in vendor/ramsey/uuid/src/Uuid.php
Creates a UUID from a byte string

File

vendor/ramsey/uuid/src/Uuid.php, line 485

Class

Uuid
Uuid provides constants and static methods for working with and generating UUIDs

Namespace

Ramsey\Uuid

Code

public static function fromString(string $uuid) : UuidInterface {
    $uuid = strtolower($uuid);
    if (!self::$factoryReplaced && preg_match(LazyUuidFromString::VALID_REGEX, $uuid) === 1) {
        assert($uuid !== '');
        return new LazyUuidFromString($uuid);
    }
    return self::getFactory()->fromString($uuid);
}

API Navigation

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