You are here

public static function Uuid::isValid in Service Container 7.2

Same name and namespace in other branches
  1. 7 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.

File

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