You are here

public static function Uuid::isValid in Zircon Profile 8

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

Checks that 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.

3 calls to Uuid::isValid()
EntityFieldDefaultValueTest::assertDefaultValues in core/modules/system/src/Tests/Entity/EntityFieldDefaultValueTest.php
Executes a test set for a defined entity type.
UuidTest::testGenerateUuid in core/tests/Drupal/Tests/Component/Uuid/UuidTest.php
Tests generating valid UUIDs.
UuidTest::testValidation in core/tests/Drupal/Tests/Component/Uuid/UuidTest.php
Tests UUID validation.

File

core/lib/Drupal/Component/Uuid/Uuid.php, line 32
Contains \Drupal\Component\Uuid\Uuid.

Class

Uuid
UUID Helper methods.

Namespace

Drupal\Component\Uuid

Code

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