function Uuid::isValid

Same name in other branches
  1. 9 core/lib/Drupal/Component/Uuid/Uuid.php \Drupal\Component\Uuid\Uuid::isValid()
  2. 8.9.x core/lib/Drupal/Component/Uuid/Uuid.php \Drupal\Component\Uuid\Uuid::isValid()
  3. 11.x 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.

10 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.
ConfigActionTest::testEntityCreate in core/tests/Drupal/KernelTests/Core/Config/Action/ConfigActionTest.php
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.

... 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.