aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/uuid/src/Generator
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-10-11 18:41:34 +0000
committerMario <mario@mariovavti.com>2022-10-11 18:41:34 +0000
commit10ba98c4f5ec4efe6272516de47f0ce128ef2902 (patch)
treefbbde69114acba764cf6b735433c53e099fd19c5 /vendor/ramsey/uuid/src/Generator
parent108a3efe0b6d37a7ed394a84c69b924ca727f17a (diff)
downloadvolse-hubzilla-10ba98c4f5ec4efe6272516de47f0ce128ef2902.tar.gz
volse-hubzilla-10ba98c4f5ec4efe6272516de47f0ce128ef2902.tar.bz2
volse-hubzilla-10ba98c4f5ec4efe6272516de47f0ce128ef2902.zip
Revert "update composer libs"
This reverts commit 108a3efe0b6d37a7ed394a84c69b924ca727f17a.
Diffstat (limited to 'vendor/ramsey/uuid/src/Generator')
-rw-r--r--vendor/ramsey/uuid/src/Generator/CombGenerator.php20
-rw-r--r--vendor/ramsey/uuid/src/Generator/DceSecurityGenerator.php27
-rw-r--r--vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php28
-rw-r--r--vendor/ramsey/uuid/src/Generator/PeclUuidNameGenerator.php21
-rw-r--r--vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php2
-rw-r--r--vendor/ramsey/uuid/src/Generator/RandomLibAdapter.php5
-rw-r--r--vendor/ramsey/uuid/src/Generator/TimeGeneratorFactory.php24
-rw-r--r--vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php52
8 files changed, 101 insertions, 78 deletions
diff --git a/vendor/ramsey/uuid/src/Generator/CombGenerator.php b/vendor/ramsey/uuid/src/Generator/CombGenerator.php
index 0e8870608..25b7988ec 100644
--- a/vendor/ramsey/uuid/src/Generator/CombGenerator.php
+++ b/vendor/ramsey/uuid/src/Generator/CombGenerator.php
@@ -61,10 +61,22 @@ class CombGenerator implements RandomGeneratorInterface
{
public const TIMESTAMP_BYTES = 6;
+ /**
+ * @var RandomGeneratorInterface
+ */
+ private $randomGenerator;
+
+ /**
+ * @var NumberConverterInterface
+ */
+ private $converter;
+
public function __construct(
- private RandomGeneratorInterface $generator,
- private NumberConverterInterface $numberConverter
+ RandomGeneratorInterface $generator,
+ NumberConverterInterface $numberConverter
) {
+ $this->converter = $numberConverter;
+ $this->randomGenerator = $generator;
}
/**
@@ -83,11 +95,11 @@ class CombGenerator implements RandomGeneratorInterface
$hash = '';
if (self::TIMESTAMP_BYTES > 0 && $length > self::TIMESTAMP_BYTES) {
- $hash = $this->generator->generate($length - self::TIMESTAMP_BYTES);
+ $hash = $this->randomGenerator->generate($length - self::TIMESTAMP_BYTES);
}
$lsbTime = str_pad(
- $this->numberConverter->toHex($this->timestamp()),
+ $this->converter->toHex($this->timestamp()),
self::TIMESTAMP_BYTES * 2,
'0',
STR_PAD_LEFT
diff --git a/vendor/ramsey/uuid/src/Generator/DceSecurityGenerator.php b/vendor/ramsey/uuid/src/Generator/DceSecurityGenerator.php
index 37ba78131..aca8c5db7 100644
--- a/vendor/ramsey/uuid/src/Generator/DceSecurityGenerator.php
+++ b/vendor/ramsey/uuid/src/Generator/DceSecurityGenerator.php
@@ -52,11 +52,29 @@ class DceSecurityGenerator implements DceSecurityGeneratorInterface
*/
private const CLOCK_SEQ_LOW = 0;
+ /**
+ * @var NumberConverterInterface
+ */
+ private $numberConverter;
+
+ /**
+ * @var TimeGeneratorInterface
+ */
+ private $timeGenerator;
+
+ /**
+ * @var DceSecurityProviderInterface
+ */
+ private $dceSecurityProvider;
+
public function __construct(
- private NumberConverterInterface $numberConverter,
- private TimeGeneratorInterface $timeGenerator,
- private DceSecurityProviderInterface $dceSecurityProvider
+ NumberConverterInterface $numberConverter,
+ TimeGeneratorInterface $timeGenerator,
+ DceSecurityProviderInterface $dceSecurityProvider
) {
+ $this->numberConverter = $numberConverter;
+ $this->timeGenerator = $timeGenerator;
+ $this->dceSecurityProvider = $dceSecurityProvider;
}
public function generate(
@@ -135,7 +153,8 @@ class DceSecurityGenerator implements DceSecurityGeneratorInterface
// Replace bytes in the time-based UUID with DCE Security values.
$bytes = substr_replace($bytes, $identifierBytes, 0, 4);
+ $bytes = substr_replace($bytes, $domainByte, 9, 1);
- return substr_replace($bytes, $domainByte, 9, 1);
+ return $bytes;
}
}
diff --git a/vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php b/vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php
index a1b39b04a..d245c7bcc 100644
--- a/vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php
+++ b/vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php
@@ -40,11 +40,29 @@ use const STR_PAD_LEFT;
*/
class DefaultTimeGenerator implements TimeGeneratorInterface
{
+ /**
+ * @var NodeProviderInterface
+ */
+ private $nodeProvider;
+
+ /**
+ * @var TimeConverterInterface
+ */
+ private $timeConverter;
+
+ /**
+ * @var TimeProviderInterface
+ */
+ private $timeProvider;
+
public function __construct(
- private NodeProviderInterface $nodeProvider,
- private TimeConverterInterface $timeConverter,
- private TimeProviderInterface $timeProvider
+ NodeProviderInterface $nodeProvider,
+ TimeConverterInterface $timeConverter,
+ TimeProviderInterface $timeProvider
) {
+ $this->nodeProvider = $nodeProvider;
+ $this->timeConverter = $timeConverter;
+ $this->timeProvider = $timeProvider;
}
/**
@@ -103,13 +121,13 @@ class DefaultTimeGenerator implements TimeGeneratorInterface
* Uses the node provider given when constructing this instance to get
* the node ID (usually a MAC address)
*
- * @param int|string|null $node A node value that may be used to override the node provider
+ * @param string|int|null $node A node value that may be used to override the node provider
*
* @return string 6-byte binary string representation of the node
*
* @throws InvalidArgumentException
*/
- private function getValidNode(int | string | null $node): string
+ private function getValidNode($node): string
{
if ($node === null) {
$node = $this->nodeProvider->getNode();
diff --git a/vendor/ramsey/uuid/src/Generator/PeclUuidNameGenerator.php b/vendor/ramsey/uuid/src/Generator/PeclUuidNameGenerator.php
index 6a6d1aec3..3780c5c60 100644
--- a/vendor/ramsey/uuid/src/Generator/PeclUuidNameGenerator.php
+++ b/vendor/ramsey/uuid/src/Generator/PeclUuidNameGenerator.php
@@ -33,16 +33,21 @@ class PeclUuidNameGenerator implements NameGeneratorInterface
/** @psalm-pure */
public function generate(UuidInterface $ns, string $name, string $hashAlgorithm): string
{
- $uuid = match ($hashAlgorithm) {
- 'md5' => uuid_generate_md5($ns->toString(), $name),
- 'sha1' => uuid_generate_sha1($ns->toString(), $name),
- default => throw new NameException(
- sprintf(
+ switch ($hashAlgorithm) {
+ case 'md5':
+ $uuid = uuid_generate_md5($ns->toString(), $name);
+
+ break;
+ case 'sha1':
+ $uuid = uuid_generate_sha1($ns->toString(), $name);
+
+ break;
+ default:
+ throw new NameException(sprintf(
'Unable to hash namespace and name with algorithm \'%s\'',
$hashAlgorithm
- )
- ),
- };
+ ));
+ }
return uuid_parse($uuid);
}
diff --git a/vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php b/vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php
index 1180b9764..5c83cb4d8 100644
--- a/vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php
+++ b/vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php
@@ -22,7 +22,7 @@ interface RandomGeneratorInterface
/**
* Generates a string of randomized binary data
*
- * @param int<1, max> $length The number of bytes of random binary data to generate
+ * @param int $length The number of bytes of random binary data to generate
*
* @return string A binary string
*/
diff --git a/vendor/ramsey/uuid/src/Generator/RandomLibAdapter.php b/vendor/ramsey/uuid/src/Generator/RandomLibAdapter.php
index fd0ccc8aa..793ccd5a4 100644
--- a/vendor/ramsey/uuid/src/Generator/RandomLibAdapter.php
+++ b/vendor/ramsey/uuid/src/Generator/RandomLibAdapter.php
@@ -29,7 +29,10 @@ use RandomLib\Generator;
*/
class RandomLibAdapter implements RandomGeneratorInterface
{
- private Generator $generator;
+ /**
+ * @var Generator
+ */
+ private $generator;
/**
* Constructs a RandomLibAdapter
diff --git a/vendor/ramsey/uuid/src/Generator/TimeGeneratorFactory.php b/vendor/ramsey/uuid/src/Generator/TimeGeneratorFactory.php
index 8d06fc3ae..3d55fc4d6 100644
--- a/vendor/ramsey/uuid/src/Generator/TimeGeneratorFactory.php
+++ b/vendor/ramsey/uuid/src/Generator/TimeGeneratorFactory.php
@@ -24,11 +24,29 @@ use Ramsey\Uuid\Provider\TimeProviderInterface;
*/
class TimeGeneratorFactory
{
+ /**
+ * @var NodeProviderInterface
+ */
+ private $nodeProvider;
+
+ /**
+ * @var TimeConverterInterface
+ */
+ private $timeConverter;
+
+ /**
+ * @var TimeProviderInterface
+ */
+ private $timeProvider;
+
public function __construct(
- private NodeProviderInterface $nodeProvider,
- private TimeConverterInterface $timeConverter,
- private TimeProviderInterface $timeProvider
+ NodeProviderInterface $nodeProvider,
+ TimeConverterInterface $timeConverter,
+ TimeProviderInterface $timeProvider
) {
+ $this->nodeProvider = $nodeProvider;
+ $this->timeConverter = $timeConverter;
+ $this->timeProvider = $timeProvider;
}
/**
diff --git a/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php b/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php
deleted file mode 100644
index 1aef8699a..000000000
--- a/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
-/**
- * This file is part of the ramsey/uuid library
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- *
- * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
- * @license http://opensource.org/licenses/MIT MIT
- */
-
-declare(strict_types=1);
-
-namespace Ramsey\Uuid\Generator;
-
-use Ramsey\Uuid\Converter\TimeConverterInterface;
-use Ramsey\Uuid\Provider\TimeProviderInterface;
-
-use function hex2bin;
-
-/**
- * UnixTimeGenerator generates bytes that combine a 48-bit timestamp in
- * milliseconds since the Unix Epoch with 80 random bits
- */
-class UnixTimeGenerator implements TimeGeneratorInterface
-{
- public function __construct(
- private TimeConverterInterface $timeConverter,
- private TimeProviderInterface $timeProvider,
- private RandomGeneratorInterface $randomGenerator
- ) {
- }
-
- /**
- * @inheritDoc
- */
- public function generate($node = null, ?int $clockSeq = null): string
- {
- // Generate 10 random bytes to append to the string returned, since our
- // time bytes will consist of 6 bytes.
- $random = $this->randomGenerator->generate(10);
-
- $time = $this->timeProvider->getTime();
- $unixTimeHex = $this->timeConverter->calculateTime(
- $time->getSeconds()->toString(),
- $time->getMicroseconds()->toString(),
- );
-
- return hex2bin($unixTimeHex->toString()) . $random;
- }
-}