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\Rfc4122Code
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,
};
}