public static function uuid($value, $message = null, $propertyPath = null)
{
$value = str_replace(array('urn:', 'uuid:', '{', '}'), '', $value);
if ($value === '00000000-0000-0000-0000-000000000000') {
return true;
}
if (!preg_match('/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/', $value)) {
$message = sprintf($message ?: 'Value "%s" is not a valid UUID.', static::stringify($value));
throw static::createException($value, $message, static::INVALID_UUID, $propertyPath);
}
return true;
}