aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-01-13 09:50:53 +0000
committerMario <mario@mariovavti.com>2021-01-13 09:50:53 +0000
commit5eefdc6485b2f6082f6fe5dfd6f1731fae7e3a2a (patch)
tree7521f4800e393538d19c393c6f495ea2d41cbf5a /vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php
parent0bc4c7d1a0e4348018e533be600ad1c648fd97fb (diff)
parent4d2bcbc5837a7d99dc541595ca8087c335242af0 (diff)
downloadvolse-hubzilla-5eefdc6485b2f6082f6fe5dfd6f1731fae7e3a2a.tar.gz
volse-hubzilla-5eefdc6485b2f6082f6fe5dfd6f1731fae7e3a2a.tar.bz2
volse-hubzilla-5eefdc6485b2f6082f6fe5dfd6f1731fae7e3a2a.zip
Merge branch '5.2RC'5.2
Diffstat (limited to 'vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php')
-rw-r--r--vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php51
1 files changed, 36 insertions, 15 deletions
diff --git a/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php b/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php
index 23cf1640b..1e8480701 100644
--- a/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php
+++ b/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php
@@ -1,4 +1,5 @@
<?php
+
/**
* This file is part of the ramsey/uuid library
*
@@ -7,31 +8,51 @@
*
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
* @license http://opensource.org/licenses/MIT MIT
- * @link https://benramsey.com/projects/ramsey-uuid/ Documentation
- * @link https://packagist.org/packages/ramsey/uuid Packagist
- * @link https://github.com/ramsey/uuid GitHub
*/
+declare(strict_types=1);
+
namespace Ramsey\Uuid\Converter;
-use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
+use Ramsey\Uuid\Type\Hexadecimal;
+use Ramsey\Uuid\Type\Time;
/**
- * TimeConverterInterface provides facilities for converting parts of time into
- * representations that may be used in UUIDs
+ * A time converter converts timestamps into representations that may be used
+ * in UUIDs
+ *
+ * @psalm-immutable
*/
interface TimeConverterInterface
{
/**
- * Uses the provided seconds and micro-seconds to calculate the time_low,
- * time_mid, and time_high fields used by RFC 4122 version 1 UUIDs
+ * Uses the provided seconds and micro-seconds to calculate the count of
+ * 100-nanosecond intervals since UTC 00:00:00.00, 15 October 1582, for
+ * RFC 4122 variant UUIDs
+ *
+ * @link http://tools.ietf.org/html/rfc4122#section-4.2.2 RFC 4122, ยง 4.2.2: Generation Details
+ *
+ * @param string $seconds A string representation of the number of seconds
+ * since the Unix epoch for the time to calculate
+ * @param string $microseconds A string representation of the micro-seconds
+ * associated with the time to calculate
+ *
+ * @return Hexadecimal The full UUID timestamp as a Hexadecimal value
+ *
+ * @psalm-pure
+ */
+ public function calculateTime(string $seconds, string $microseconds): Hexadecimal;
+
+ /**
+ * Converts a timestamp extracted from a UUID to a Unix timestamp
+ *
+ * @param Hexadecimal $uuidTimestamp A hexadecimal representation of a UUID
+ * timestamp; a UUID timestamp is a count of 100-nanosecond intervals
+ * since UTC 00:00:00.00, 15 October 1582.
+ *
+ * @return Time An instance of {@see Time}
*
- * @param string $seconds
- * @param string $microSeconds
- * @return string[] An array guaranteed to contain `low`, `mid`, and `hi` keys
- * @throws UnsatisfiedDependencyException if called on a 32-bit system and
- * `Moontoast\Math\BigNumber` is not present
- * @link http://tools.ietf.org/html/rfc4122#section-4.2.2
+ * @psalm-pure
*/
- public function calculateTime($seconds, $microSeconds);
+ public function convertTime(Hexadecimal $uuidTimestamp): Time;
}