aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/uuid/src/Rfc4122/VariantTrait.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-10-11 18:29:06 +0000
committerMario <mario@mariovavti.com>2022-10-11 18:29:06 +0000
commitccd826f63a7a4c7e442fab8a70d9c4c84808b417 (patch)
treefbbde69114acba764cf6b735433c53e099fd19c5 /vendor/ramsey/uuid/src/Rfc4122/VariantTrait.php
parent5e5f0aa955d86743a14531bed98501b59140ab1f (diff)
downloadvolse-hubzilla-ccd826f63a7a4c7e442fab8a70d9c4c84808b417.tar.gz
volse-hubzilla-ccd826f63a7a4c7e442fab8a70d9c4c84808b417.tar.bz2
volse-hubzilla-ccd826f63a7a4c7e442fab8a70d9c4c84808b417.zip
Revert "update composer libs"
This reverts commit 5e5f0aa955d86743a14531bed98501b59140ab1f.
Diffstat (limited to 'vendor/ramsey/uuid/src/Rfc4122/VariantTrait.php')
-rw-r--r--vendor/ramsey/uuid/src/Rfc4122/VariantTrait.php24
1 files changed, 10 insertions, 14 deletions
diff --git a/vendor/ramsey/uuid/src/Rfc4122/VariantTrait.php b/vendor/ramsey/uuid/src/Rfc4122/VariantTrait.php
index 1041de51e..4c981658f 100644
--- a/vendor/ramsey/uuid/src/Rfc4122/VariantTrait.php
+++ b/vendor/ramsey/uuid/src/Rfc4122/VariantTrait.php
@@ -19,8 +19,8 @@ use Ramsey\Uuid\Uuid;
use function decbin;
use function str_pad;
-use function str_starts_with;
use function strlen;
+use function strpos;
use function substr;
use function unpack;
@@ -58,13 +58,7 @@ trait VariantTrait
throw new InvalidBytesException('Invalid number of bytes');
}
- if ($this->isMax() || $this->isNil()) {
- // RFC 4122 defines these special types of UUID, so we will consider
- // them as belonging to the RFC 4122 variant.
- return Uuid::RFC_4122;
- }
-
- /** @var int[] $parts */
+ /** @var array $parts */
$parts = unpack('n*', $this->getBytes());
// $parts[5] is a 16-bit, unsigned integer containing the variant bits
@@ -73,7 +67,7 @@ trait VariantTrait
// three characters (three most-significant bits) to determine the
// variant.
$binary = str_pad(
- decbin($parts[5]),
+ decbin((int) $parts[5]),
16,
'0',
STR_PAD_LEFT
@@ -82,13 +76,15 @@ trait VariantTrait
$msb = substr($binary, 0, 3);
if ($msb === '111') {
- return Uuid::RESERVED_FUTURE;
+ $variant = Uuid::RESERVED_FUTURE;
} elseif ($msb === '110') {
- return Uuid::RESERVED_MICROSOFT;
- } elseif (str_starts_with($msb, '10')) {
- return Uuid::RFC_4122;
+ $variant = Uuid::RESERVED_MICROSOFT;
+ } elseif (strpos($msb, '10') === 0) {
+ $variant = Uuid::RFC_4122;
+ } else {
+ $variant = Uuid::RESERVED_NCS;
}
- return Uuid::RESERVED_NCS;
+ return $variant;
}
}