Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. VersionTrait.php

function VersionTrait::isCorrectVersion

Returns true if the version matches one of those defined by RFC 4122

Return value

bool True if the UUID version is valid, false otherwise

2 calls to VersionTrait::isCorrectVersion()
Fields::__construct in vendor/ramsey/uuid/src/Guid/Fields.php
Fields::__construct in vendor/ramsey/uuid/src/Rfc4122/Fields.php

File

vendor/ramsey/uuid/src/Rfc4122/VersionTrait.php, line 46

Class

VersionTrait
Provides common functionality for handling the version, as defined by RFC 4122

Namespace

Ramsey\Uuid\Rfc4122

Code

private function isCorrectVersion() : bool {
    if ($this->isNil() || $this->isMax()) {
        return true;
    }
    return match ($this->getVersion()) {    Uuid::UUID_TYPE_TIME, Uuid::UUID_TYPE_DCE_SECURITY, Uuid::UUID_TYPE_HASH_MD5, Uuid::UUID_TYPE_RANDOM, Uuid::UUID_TYPE_HASH_SHA1, Uuid::UUID_TYPE_REORDERED_TIME, Uuid::UUID_TYPE_UNIX_TIME, Uuid::UUID_TYPE_CUSTOM => true,
        default => false,
    
    };
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal