diff options
author | Mario Vavti <mario@mariovavti.com> | 2018-08-28 12:00:23 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2018-08-28 12:00:23 +0200 |
commit | c0c827d3ad2c8364d35fff5546ab40ea76bbbbd9 (patch) | |
tree | 34bb14bb6046ce98bd6ad759b9c57624b2be7d34 /vendor/ramsey/uuid/src/BinaryUtils.php | |
parent | 6a2bbed73dfb34975c4525c34c03f20c6945dedc (diff) | |
download | volse-hubzilla-c0c827d3ad2c8364d35fff5546ab40ea76bbbbd9.tar.gz volse-hubzilla-c0c827d3ad2c8364d35fff5546ab40ea76bbbbd9.tar.bz2 volse-hubzilla-c0c827d3ad2c8364d35fff5546ab40ea76bbbbd9.zip |
update composer libs and add ramsey/uuid
Diffstat (limited to 'vendor/ramsey/uuid/src/BinaryUtils.php')
-rw-r--r-- | vendor/ramsey/uuid/src/BinaryUtils.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/vendor/ramsey/uuid/src/BinaryUtils.php b/vendor/ramsey/uuid/src/BinaryUtils.php new file mode 100644 index 000000000..f04a9d9c1 --- /dev/null +++ b/vendor/ramsey/uuid/src/BinaryUtils.php @@ -0,0 +1,43 @@ +<?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 &= ~(0xc0); + $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 &= ~(0xf000); + $timeHi |= $version << 12; + + return $timeHi; + } +} |