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

Breadcrumb

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

function Uuid::isValid

Same name in this branch
  1. 11.1.x core/lib/Drupal/Component/Uuid/Uuid.php \Drupal\Component\Uuid\Uuid::isValid()

Returns true if the provided string is a valid UUID

@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-assert-if-true =non-empty-string $uuid

Parameters

string $uuid A string to validate as a UUID:

Return value

bool True if the string is a valid UUID, false otherwise

1 call to Uuid::isValid()
StringCodec::getBytes in vendor/ramsey/uuid/src/Codec/StringCodec.php
Returns a byte string of the UUID

File

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

Class

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

Namespace

Ramsey\Uuid

Code

public static function isValid(string $uuid) : bool {
    
    /** @psalm-suppress ImpureMethodCall */
    return self::getFactory()->getValidator()
        ->validate($uuid);
}

API Navigation

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