diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:38:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:38:42 +0000 |
commit | c3ca98e1b35123f226c7f4c596b5dee78caa4223 (patch) | |
tree | 9b6eb109283da55e7d9064baa9fac795a40264cb /vendor/ramsey/uuid/src/BinaryUtils.php | |
parent | Initial commit. (diff) | |
download | icinga-php-thirdparty-upstream.tar.xz icinga-php-thirdparty-upstream.zip |
Adding upstream version 0.11.0.upstream/0.11.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/ramsey/uuid/src/BinaryUtils.php')
-rw-r--r-- | vendor/ramsey/uuid/src/BinaryUtils.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/vendor/ramsey/uuid/src/BinaryUtils.php b/vendor/ramsey/uuid/src/BinaryUtils.php new file mode 100644 index 0000000..18ea467 --- /dev/null +++ b/vendor/ramsey/uuid/src/BinaryUtils.php @@ -0,0 +1,41 @@ +<?php + +namespace Ramsey\Uuid; + +/** + * Provides binary math utilities + */ +class BinaryUtils +{ + /** + * Applies the RFC 4122 variant field to the `clock_seq_hi_and_reserved` field + * + * @param $clockSeqHi + * @return int The high field of the clock sequence multiplexed with the variant + * @link http://tools.ietf.org/html/rfc4122#section-4.1.1 + */ + public static function applyVariant($clockSeqHi) + { + // Set the variant to RFC 4122 + $clockSeqHi = $clockSeqHi & 0x3f; + $clockSeqHi |= 0x80; + + return $clockSeqHi; + } + + /** + * Applies the RFC 4122 version number to the `time_hi_and_version` field + * + * @param string $timeHi + * @param integer $version + * @return int The high field of the timestamp multiplexed with the version number + * @link http://tools.ietf.org/html/rfc4122#section-4.1.3 + */ + public static function applyVersion($timeHi, $version) + { + $timeHi = hexdec($timeHi) & 0x0fff; + $timeHi |= $version << 12; + + return $timeHi; + } +} |