aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/uuid/src/Rfc4122/VersionTrait.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-10-12 08:45:01 +0000
committerMario <mario@mariovavti.com>2022-10-12 08:45:01 +0000
commit8bf5c18425cf15327fa11494e6e0d3749f36c6f8 (patch)
treefc358336312cd23030321a43f276db19cea17621 /vendor/ramsey/uuid/src/Rfc4122/VersionTrait.php
parentc36bb17475b3dd5925cefc32752f1fb8a63df154 (diff)
downloadvolse-hubzilla-8bf5c18425cf15327fa11494e6e0d3749f36c6f8.tar.gz
volse-hubzilla-8bf5c18425cf15327fa11494e6e0d3749f36c6f8.tar.bz2
volse-hubzilla-8bf5c18425cf15327fa11494e6e0d3749f36c6f8.zip
composer update ramsey/uuid
Diffstat (limited to 'vendor/ramsey/uuid/src/Rfc4122/VersionTrait.php')
-rw-r--r--vendor/ramsey/uuid/src/Rfc4122/VersionTrait.php27
1 files changed, 15 insertions, 12 deletions
diff --git a/vendor/ramsey/uuid/src/Rfc4122/VersionTrait.php b/vendor/ramsey/uuid/src/Rfc4122/VersionTrait.php
index cee55fbef..316f780c4 100644
--- a/vendor/ramsey/uuid/src/Rfc4122/VersionTrait.php
+++ b/vendor/ramsey/uuid/src/Rfc4122/VersionTrait.php
@@ -14,6 +14,8 @@ declare(strict_types=1);
namespace Ramsey\Uuid\Rfc4122;
+use Ramsey\Uuid\Uuid;
+
/**
* Provides common functionality for handling the version, as defined by RFC 4122
*
@@ -27,6 +29,11 @@ trait VersionTrait
abstract public function getVersion(): ?int;
/**
+ * Returns true if these fields represent a max UUID
+ */
+ abstract public function isMax(): bool;
+
+ /**
* Returns true if these fields represent a nil UUID
*/
abstract public function isNil(): bool;
@@ -38,20 +45,16 @@ trait VersionTrait
*/
private function isCorrectVersion(): bool
{
- if ($this->isNil()) {
+ if ($this->isNil() || $this->isMax()) {
return true;
}
- switch ($this->getVersion()) {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- return true;
- }
-
- return false;
+ 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 => true,
+ default => false,
+ };
}
}