You are here

public static function Uuid::isValid in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Uuid/Uuid.php \Drupal\Component\Uuid\Uuid::isValid()
  2. 9 core/lib/Drupal/Component/Uuid/Uuid.php \Drupal\Component\Uuid\Uuid::isValid()

Checks whether a string appears to be in the format of a UUID.

Implementations should not implement validation, since UUIDs should be in a consistent format across all implementations.

Parameters

string $uuid: The string to test.

Return value

bool TRUE if the string is well formed, FALSE otherwise.

8 calls to Uuid::isValid()
CKEditor5MediaController::access in core/modules/ckeditor5/src/Controller/CKEditor5MediaController.php
Additional access check for ::isMediaImage().
CKEditor5MediaController::mediaEntityMetadata in core/modules/ckeditor5/src/Controller/CKEditor5MediaController.php
Returns JSON response containing metadata about media entity.
ConfigEntityTest::testCRUD in core/modules/config/tests/src/Functional/ConfigEntityTest.php
Tests CRUD operations.
ConfigInstallProfileOverrideTest::testInstallProfileConfigOverwrite in core/modules/config/tests/src/Functional/ConfigInstallProfileOverrideTest.php
Tests install profile config changes.
EntityFieldDefaultValueTest::assertDefaultValues in core/tests/Drupal/KernelTests/Core/Entity/EntityFieldDefaultValueTest.php
Executes a test set for a defined entity type.

... See full list

File

core/lib/Drupal/Component/Uuid/Uuid.php, line 27

Class

Uuid
UUID Helper methods.

Namespace

Drupal\Component\Uuid

Code

public static function isValid($uuid) {
  return (bool) preg_match('/^' . self::VALID_PATTERN . '$/', $uuid);
}