Aggiornato Composer
This commit is contained in:
135
vendor/ramsey/uuid/src/FeatureSet.php
vendored
135
vendor/ramsey/uuid/src/FeatureSet.php
vendored
@@ -35,6 +35,7 @@ use Ramsey\Uuid\Generator\RandomGeneratorFactory;
|
||||
use Ramsey\Uuid\Generator\RandomGeneratorInterface;
|
||||
use Ramsey\Uuid\Generator\TimeGeneratorFactory;
|
||||
use Ramsey\Uuid\Generator\TimeGeneratorInterface;
|
||||
use Ramsey\Uuid\Generator\UnixTimeGenerator;
|
||||
use Ramsey\Uuid\Guid\GuidBuilder;
|
||||
use Ramsey\Uuid\Math\BrickMathCalculator;
|
||||
use Ramsey\Uuid\Math\CalculatorInterface;
|
||||
@@ -61,92 +62,25 @@ use const PHP_INT_SIZE;
|
||||
*/
|
||||
class FeatureSet
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $disableBigNumber = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $disable64Bit = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $ignoreSystemNode = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $enablePecl = false;
|
||||
|
||||
/**
|
||||
* @var UuidBuilderInterface
|
||||
*/
|
||||
private $builder;
|
||||
|
||||
/**
|
||||
* @var CodecInterface
|
||||
*/
|
||||
private $codec;
|
||||
|
||||
/**
|
||||
* @var DceSecurityGeneratorInterface
|
||||
*/
|
||||
private $dceSecurityGenerator;
|
||||
|
||||
/**
|
||||
* @var NameGeneratorInterface
|
||||
*/
|
||||
private $nameGenerator;
|
||||
|
||||
/**
|
||||
* @var NodeProviderInterface
|
||||
*/
|
||||
private $nodeProvider;
|
||||
|
||||
/**
|
||||
* @var NumberConverterInterface
|
||||
*/
|
||||
private $numberConverter;
|
||||
|
||||
/**
|
||||
* @var TimeConverterInterface
|
||||
*/
|
||||
private $timeConverter;
|
||||
|
||||
/**
|
||||
* @var RandomGeneratorInterface
|
||||
*/
|
||||
private $randomGenerator;
|
||||
|
||||
/**
|
||||
* @var TimeGeneratorInterface
|
||||
*/
|
||||
private $timeGenerator;
|
||||
|
||||
/**
|
||||
* @var TimeProviderInterface
|
||||
*/
|
||||
private $timeProvider;
|
||||
|
||||
/**
|
||||
* @var ValidatorInterface
|
||||
*/
|
||||
private $validator;
|
||||
|
||||
/**
|
||||
* @var CalculatorInterface
|
||||
*/
|
||||
private $calculator;
|
||||
private ?TimeProviderInterface $timeProvider = null;
|
||||
private CalculatorInterface $calculator;
|
||||
private CodecInterface $codec;
|
||||
private DceSecurityGeneratorInterface $dceSecurityGenerator;
|
||||
private NameGeneratorInterface $nameGenerator;
|
||||
private NodeProviderInterface $nodeProvider;
|
||||
private NumberConverterInterface $numberConverter;
|
||||
private RandomGeneratorInterface $randomGenerator;
|
||||
private TimeConverterInterface $timeConverter;
|
||||
private TimeGeneratorInterface $timeGenerator;
|
||||
private TimeGeneratorInterface $unixTimeGenerator;
|
||||
private UuidBuilderInterface $builder;
|
||||
private ValidatorInterface $validator;
|
||||
|
||||
/**
|
||||
* @param bool $useGuids True build UUIDs using the GuidStringCodec
|
||||
* @param bool $force32Bit True to force the use of 32-bit functionality
|
||||
* (primarily for testing purposes)
|
||||
* @param bool $forceNoBigNumber True to disable the use of moontoast/math
|
||||
* (primarily for testing purposes)
|
||||
* @param bool $forceNoBigNumber (obsolete)
|
||||
* @param bool $ignoreSystemNode True to disable attempts to check for the
|
||||
* system node ID (primarily for testing purposes)
|
||||
* @param bool $enablePecl True to enable the use of the PeclUuidTimeGenerator
|
||||
@@ -154,25 +88,23 @@ class FeatureSet
|
||||
*/
|
||||
public function __construct(
|
||||
bool $useGuids = false,
|
||||
bool $force32Bit = false,
|
||||
private bool $force32Bit = false,
|
||||
bool $forceNoBigNumber = false,
|
||||
bool $ignoreSystemNode = false,
|
||||
bool $enablePecl = false
|
||||
private bool $ignoreSystemNode = false,
|
||||
private bool $enablePecl = false
|
||||
) {
|
||||
$this->disableBigNumber = $forceNoBigNumber;
|
||||
$this->disable64Bit = $force32Bit;
|
||||
$this->ignoreSystemNode = $ignoreSystemNode;
|
||||
$this->enablePecl = $enablePecl;
|
||||
|
||||
$this->randomGenerator = $this->buildRandomGenerator();
|
||||
$this->setCalculator(new BrickMathCalculator());
|
||||
$this->builder = $this->buildUuidBuilder($useGuids);
|
||||
$this->codec = $this->buildCodec($useGuids);
|
||||
$this->nodeProvider = $this->buildNodeProvider();
|
||||
$this->nameGenerator = $this->buildNameGenerator();
|
||||
$this->randomGenerator = $this->buildRandomGenerator();
|
||||
$this->setTimeProvider(new SystemTimeProvider());
|
||||
$this->setDceSecurityProvider(new SystemDceSecurityProvider());
|
||||
$this->validator = new GenericValidator();
|
||||
|
||||
assert($this->timeProvider !== null);
|
||||
$this->unixTimeGenerator = $this->buildUnixTimeGenerator();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -255,6 +187,14 @@ class FeatureSet
|
||||
return $this->timeGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Unix Epoch time generator configured for this environment
|
||||
*/
|
||||
public function getUnixTimeGenerator(): TimeGeneratorInterface
|
||||
{
|
||||
return $this->unixTimeGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the validator configured for this environment
|
||||
*/
|
||||
@@ -292,7 +232,10 @@ class FeatureSet
|
||||
public function setNodeProvider(NodeProviderInterface $nodeProvider): void
|
||||
{
|
||||
$this->nodeProvider = $nodeProvider;
|
||||
$this->timeGenerator = $this->buildTimeGenerator($this->timeProvider);
|
||||
|
||||
if (isset($this->timeProvider)) {
|
||||
$this->timeGenerator = $this->buildTimeGenerator($this->timeProvider);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -393,6 +336,14 @@ class FeatureSet
|
||||
))->getGenerator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Unix Epoch time generator configured for this environment
|
||||
*/
|
||||
private function buildUnixTimeGenerator(): TimeGeneratorInterface
|
||||
{
|
||||
return new UnixTimeGenerator($this->randomGenerator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a name generator configured for this environment
|
||||
*/
|
||||
@@ -441,6 +392,6 @@ class FeatureSet
|
||||
*/
|
||||
private function is64BitSystem(): bool
|
||||
{
|
||||
return PHP_INT_SIZE === 8 && !$this->disable64Bit;
|
||||
return PHP_INT_SIZE === 8 && !$this->force32Bit;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user