diff options
author | Mario <mario@mariovavti.com> | 2020-11-05 08:46:42 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-11-05 08:46:42 +0000 |
commit | bafbf0416462c6f18c3fb6c8c06a063c8d6fdae6 (patch) | |
tree | 8929845be585b09d0f420621281c5531e1efad3e /vendor/ramsey/uuid/src | |
parent | 6f93d9848c43019d43ea76c27d42d657ba031cd7 (diff) | |
parent | fdefa101d84dc2a9424eaedbdb003a4c30ec5d01 (diff) | |
download | volse-hubzilla-5.0.tar.gz volse-hubzilla-5.0.tar.bz2 volse-hubzilla-5.0.zip |
Merge branch '5.0RC'5.0
Diffstat (limited to 'vendor/ramsey/uuid/src')
35 files changed, 310 insertions, 143 deletions
diff --git a/vendor/ramsey/uuid/src/BinaryUtils.php b/vendor/ramsey/uuid/src/BinaryUtils.php index f04a9d9c1..18ea467d9 100644 --- a/vendor/ramsey/uuid/src/BinaryUtils.php +++ b/vendor/ramsey/uuid/src/BinaryUtils.php @@ -18,7 +18,6 @@ class BinaryUtils { // Set the variant to RFC 4122 $clockSeqHi = $clockSeqHi & 0x3f; - $clockSeqHi &= ~(0xc0); $clockSeqHi |= 0x80; return $clockSeqHi; @@ -35,7 +34,6 @@ class BinaryUtils public static function applyVersion($timeHi, $version) { $timeHi = hexdec($timeHi) & 0x0fff; - $timeHi &= ~(0xf000); $timeHi |= $version << 12; return $timeHi; diff --git a/vendor/ramsey/uuid/src/Codec/CodecInterface.php b/vendor/ramsey/uuid/src/Codec/CodecInterface.php index 6ea20544f..c6c54c78a 100644 --- a/vendor/ramsey/uuid/src/Codec/CodecInterface.php +++ b/vendor/ramsey/uuid/src/Codec/CodecInterface.php @@ -14,6 +14,8 @@ namespace Ramsey\Uuid\Codec; +use InvalidArgumentException; +use Ramsey\Uuid\Exception\InvalidUuidStringException; use Ramsey\Uuid\UuidInterface; /** @@ -42,7 +44,7 @@ interface CodecInterface * * @param string $encodedUuid * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws InvalidUuidStringException */ public function decode($encodedUuid); @@ -51,8 +53,8 @@ interface CodecInterface * * @param string $bytes * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException - * @throws \InvalidArgumentException if string has not 16 characters + * @throws InvalidUuidStringException + * @throws InvalidArgumentException if string has not 16 characters */ public function decodeBytes($bytes); } diff --git a/vendor/ramsey/uuid/src/Codec/GuidStringCodec.php b/vendor/ramsey/uuid/src/Codec/GuidStringCodec.php index 864980b30..367548070 100644 --- a/vendor/ramsey/uuid/src/Codec/GuidStringCodec.php +++ b/vendor/ramsey/uuid/src/Codec/GuidStringCodec.php @@ -14,6 +14,7 @@ namespace Ramsey\Uuid\Codec; +use Ramsey\Uuid\Exception\InvalidUuidStringException; use Ramsey\Uuid\UuidInterface; /** @@ -60,7 +61,7 @@ class GuidStringCodec extends StringCodec * * @param string $encodedUuid * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws InvalidUuidStringException */ public function decode($encodedUuid) { @@ -76,7 +77,7 @@ class GuidStringCodec extends StringCodec * * @param string $bytes * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws InvalidUuidStringException */ public function decodeBytes($bytes) { diff --git a/vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php b/vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php index 3257759c9..de91aab8d 100644 --- a/vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php +++ b/vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php @@ -50,7 +50,7 @@ class OrderedTimeCodec extends StringCodec * * @param string $bytes * @return UuidInterface - * @throws \InvalidArgumentException if string has not 16 characters + * @throws InvalidArgumentException if string has not 16 characters */ public function decodeBytes($bytes) { diff --git a/vendor/ramsey/uuid/src/Codec/StringCodec.php b/vendor/ramsey/uuid/src/Codec/StringCodec.php index 7f352065c..f1bc0249a 100644 --- a/vendor/ramsey/uuid/src/Codec/StringCodec.php +++ b/vendor/ramsey/uuid/src/Codec/StringCodec.php @@ -74,7 +74,7 @@ class StringCodec implements CodecInterface * * @param string $encodedUuid * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws InvalidUuidStringException */ public function decode($encodedUuid) { @@ -89,7 +89,7 @@ class StringCodec implements CodecInterface * * @param string $bytes * @return UuidInterface - * @throws \InvalidArgumentException if string has not 16 characters + * @throws InvalidArgumentException if string has not 16 characters */ public function decodeBytes($bytes) { @@ -117,28 +117,28 @@ class StringCodec implements CodecInterface * * @param string $encodedUuid * @return array - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws InvalidUuidStringException */ protected function extractComponents($encodedUuid) { - $nameParsed = str_replace(array( + $nameParsed = str_replace([ 'urn:', 'uuid:', '{', '}', '-' - ), '', $encodedUuid); + ], '', $encodedUuid); // We have stripped out the dashes and are breaking up the string using // substr(). In this way, we can accept a full hex value that doesn't // contain dashes. - $components = array( + $components = [ substr($nameParsed, 0, 8), substr($nameParsed, 8, 4), substr($nameParsed, 12, 4), substr($nameParsed, 16, 4), substr($nameParsed, 20) - ); + ]; $nameParsed = implode('-', $components); @@ -158,13 +158,13 @@ class StringCodec implements CodecInterface */ protected function getFields(array $components) { - return array( + return [ 'time_low' => str_pad($components[0], 8, '0', STR_PAD_LEFT), 'time_mid' => str_pad($components[1], 4, '0', STR_PAD_LEFT), 'time_hi_and_version' => str_pad($components[2], 4, '0', STR_PAD_LEFT), 'clock_seq_hi_and_reserved' => str_pad(substr($components[3], 0, 2), 2, '0', STR_PAD_LEFT), 'clock_seq_low' => str_pad(substr($components[3], 2), 2, '0', STR_PAD_LEFT), 'node' => str_pad($components[4], 12, '0', STR_PAD_LEFT) - ); + ]; } } diff --git a/vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php b/vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php index 2c4ded89e..9d13af70c 100644 --- a/vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php +++ b/vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php @@ -13,10 +13,11 @@ */ namespace Ramsey\Uuid\Codec; +use Ramsey\Uuid\Exception\InvalidUuidStringException; use Ramsey\Uuid\UuidInterface; /** - * TimestampLastCombCodec encodes and decodes COMB UUIDs which have the timestamp as the first 48 bits. + * TimestampFirstCombCodec encodes and decodes COMB UUIDs which have the timestamp as the first 48 bits. * To be used with MySQL, PostgreSQL, Oracle. */ class TimestampFirstCombCodec extends StringCodec @@ -60,7 +61,7 @@ class TimestampFirstCombCodec extends StringCodec * @param string $encodedUuid * * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws InvalidUuidStringException */ public function decode($encodedUuid) { @@ -77,7 +78,7 @@ class TimestampFirstCombCodec extends StringCodec * @param string $bytes * * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws InvalidUuidStringException */ public function decodeBytes($bytes) { diff --git a/vendor/ramsey/uuid/src/Codec/TimestampLastCombCodec.php b/vendor/ramsey/uuid/src/Codec/TimestampLastCombCodec.php index 0cdd009a4..240f613e2 100644 --- a/vendor/ramsey/uuid/src/Codec/TimestampLastCombCodec.php +++ b/vendor/ramsey/uuid/src/Codec/TimestampLastCombCodec.php @@ -19,5 +19,4 @@ namespace Ramsey\Uuid\Codec; */ class TimestampLastCombCodec extends StringCodec { - } diff --git a/vendor/ramsey/uuid/src/Converter/NumberConverterInterface.php b/vendor/ramsey/uuid/src/Converter/NumberConverterInterface.php index 9505e8c6d..b978e2e7b 100644 --- a/vendor/ramsey/uuid/src/Converter/NumberConverterInterface.php +++ b/vendor/ramsey/uuid/src/Converter/NumberConverterInterface.php @@ -14,6 +14,8 @@ namespace Ramsey\Uuid\Converter; +use Ramsey\Uuid\Exception\UnsatisfiedDependencyException; + /** * NumberConverterInterface converts UUIDs from hexadecimal characters into * representations of integers and vice versa @@ -28,7 +30,7 @@ interface NumberConverterInterface * * @param string $hex The hexadecimal string representation to convert * @return mixed - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present */ public function fromHex($hex); @@ -40,7 +42,7 @@ interface NumberConverterInterface * a true integer, a string integer, or a object representation that * this converter can understand * @return string Hexadecimal string - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present */ public function toHex($integer); } diff --git a/vendor/ramsey/uuid/src/Converter/Time/BigNumberTimeConverter.php b/vendor/ramsey/uuid/src/Converter/Time/BigNumberTimeConverter.php index d47c80191..112f72272 100644 --- a/vendor/ramsey/uuid/src/Converter/Time/BigNumberTimeConverter.php +++ b/vendor/ramsey/uuid/src/Converter/Time/BigNumberTimeConverter.php @@ -43,16 +43,17 @@ class BigNumberTimeConverter implements TimeConverterInterface $usec = new BigNumber($microSeconds); $usec->multiply('10'); - $uuidTime->add($sec) + $uuidTime + ->add($sec) ->add($usec) ->add('122192928000000000'); $uuidTimeHex = sprintf('%016s', $uuidTime->convertToBase(16)); - return array( + return [ 'low' => substr($uuidTimeHex, 8), 'mid' => substr($uuidTimeHex, 4, 4), 'hi' => substr($uuidTimeHex, 0, 4), - ); + ]; } } diff --git a/vendor/ramsey/uuid/src/Converter/Time/PhpTimeConverter.php b/vendor/ramsey/uuid/src/Converter/Time/PhpTimeConverter.php index 6a9da74b8..57c882dbb 100644 --- a/vendor/ramsey/uuid/src/Converter/Time/PhpTimeConverter.php +++ b/vendor/ramsey/uuid/src/Converter/Time/PhpTimeConverter.php @@ -38,10 +38,10 @@ class PhpTimeConverter implements TimeConverterInterface // UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00. $uuidTime = ($seconds * 10000000) + ($microSeconds * 10) + 0x01b21dd213814000; - return array( + return [ 'low' => sprintf('%08x', $uuidTime & 0xffffffff), 'mid' => sprintf('%04x', ($uuidTime >> 32) & 0xffff), 'hi' => sprintf('%04x', ($uuidTime >> 48) & 0x0fff), - ); + ]; } } diff --git a/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php b/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php index 382008ac3..23cf1640b 100644 --- a/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php +++ b/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php @@ -14,6 +14,8 @@ namespace Ramsey\Uuid\Converter; +use Ramsey\Uuid\Exception\UnsatisfiedDependencyException; + /** * TimeConverterInterface provides facilities for converting parts of time into * representations that may be used in UUIDs @@ -26,8 +28,8 @@ interface TimeConverterInterface * * @param string $seconds * @param string $microSeconds - * @return string[] An array guaranteed to contain `low`, `mid`, and `high` keys - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called on a 32-bit system and + * @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 */ diff --git a/vendor/ramsey/uuid/src/DegradedUuid.php b/vendor/ramsey/uuid/src/DegradedUuid.php index bcf0be800..4e11272d0 100644 --- a/vendor/ramsey/uuid/src/DegradedUuid.php +++ b/vendor/ramsey/uuid/src/DegradedUuid.php @@ -14,6 +14,8 @@ namespace Ramsey\Uuid; +use DateTime; +use Moontoast\Math\BigNumber; use Ramsey\Uuid\Exception\UnsatisfiedDependencyException; use Ramsey\Uuid\Exception\UnsupportedOperationException; @@ -35,13 +37,13 @@ class DegradedUuid extends Uuid $time = $this->converter->fromHex($this->getTimestampHex()); - $ts = new \Moontoast\Math\BigNumber($time, 20); + $ts = new BigNumber($time, 20); $ts->subtract('122192928000000000'); $ts->divide('10000000.0'); - $ts->round(); + $ts->floor(); $unixTime = $ts->getValue(); - return new \DateTime("@{$unixTime}"); + return new DateTime("@{$unixTime}"); } /** diff --git a/vendor/ramsey/uuid/src/Exception/InvalidUuidStringException.php b/vendor/ramsey/uuid/src/Exception/InvalidUuidStringException.php index 0e480649d..7df0e8cce 100644 --- a/vendor/ramsey/uuid/src/Exception/InvalidUuidStringException.php +++ b/vendor/ramsey/uuid/src/Exception/InvalidUuidStringException.php @@ -14,9 +14,11 @@ namespace Ramsey\Uuid\Exception; +use InvalidArgumentException; + /** * Thrown to indicate that the parsed UUID string is invalid. */ -class InvalidUuidStringException extends \InvalidArgumentException +class InvalidUuidStringException extends InvalidArgumentException { } diff --git a/vendor/ramsey/uuid/src/Exception/UnsatisfiedDependencyException.php b/vendor/ramsey/uuid/src/Exception/UnsatisfiedDependencyException.php index 8b5d5d08e..89c739658 100644 --- a/vendor/ramsey/uuid/src/Exception/UnsatisfiedDependencyException.php +++ b/vendor/ramsey/uuid/src/Exception/UnsatisfiedDependencyException.php @@ -14,10 +14,12 @@ namespace Ramsey\Uuid\Exception; +use RuntimeException; + /** * Thrown to indicate that the requested operation has dependencies that have not * been satisfied. */ -class UnsatisfiedDependencyException extends \RuntimeException +class UnsatisfiedDependencyException extends RuntimeException { } diff --git a/vendor/ramsey/uuid/src/Exception/UnsupportedOperationException.php b/vendor/ramsey/uuid/src/Exception/UnsupportedOperationException.php index b371b6823..43409470d 100644 --- a/vendor/ramsey/uuid/src/Exception/UnsupportedOperationException.php +++ b/vendor/ramsey/uuid/src/Exception/UnsupportedOperationException.php @@ -14,9 +14,11 @@ namespace Ramsey\Uuid\Exception; +use RuntimeException; + /** * Thrown to indicate that the requested operation is not supported. */ -class UnsupportedOperationException extends \RuntimeException +class UnsupportedOperationException extends RuntimeException { } diff --git a/vendor/ramsey/uuid/src/FeatureSet.php b/vendor/ramsey/uuid/src/FeatureSet.php index 56a774eab..2027b9e02 100644 --- a/vendor/ramsey/uuid/src/FeatureSet.php +++ b/vendor/ramsey/uuid/src/FeatureSet.php @@ -289,7 +289,9 @@ class FeatureSet { if ($this->is64BitSystem()) { return new PhpTimeConverter(); - } elseif ($this->hasBigNumber()) { + } + + if ($this->hasBigNumber()) { return new BigNumberTimeConverter(); } diff --git a/vendor/ramsey/uuid/src/Generator/CombGenerator.php b/vendor/ramsey/uuid/src/Generator/CombGenerator.php index 7a9482318..1d4a5f604 100644 --- a/vendor/ramsey/uuid/src/Generator/CombGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/CombGenerator.php @@ -14,7 +14,10 @@ namespace Ramsey\Uuid\Generator; +use Exception; +use InvalidArgumentException; use Ramsey\Uuid\Converter\NumberConverterInterface; +use Ramsey\Uuid\Exception\UnsatisfiedDependencyException; /** * CombGenerator provides functionality to generate COMB (combined GUID/timestamp) @@ -53,14 +56,14 @@ class CombGenerator implements RandomGeneratorInterface * * @param integer $length The number of bytes of random binary data to generate * @return string A binary string - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present - * @throws \InvalidArgumentException if length is not a positive integer - * @throws \Exception + * @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws InvalidArgumentException if length is not a positive integer + * @throws Exception */ public function generate($length) { if ($length < self::TIMESTAMP_BYTES || $length < 0) { - throw new \InvalidArgumentException('Length must be a positive integer.'); + throw new InvalidArgumentException('Length must be a positive integer.'); } $hash = ''; diff --git a/vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php b/vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php index c9969b3af..5c5ccb294 100644 --- a/vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php @@ -14,8 +14,11 @@ namespace Ramsey\Uuid\Generator; +use Exception; +use InvalidArgumentException; use Ramsey\Uuid\BinaryUtils; use Ramsey\Uuid\Converter\TimeConverterInterface; +use Ramsey\Uuid\Exception\UnsatisfiedDependencyException; use Ramsey\Uuid\Provider\NodeProviderInterface; use Ramsey\Uuid\Provider\TimeProviderInterface; @@ -72,10 +75,10 @@ class DefaultTimeGenerator implements TimeGeneratorInterface * could arise when the clock is set backwards in time or if the node ID * changes. * @return string A binary string - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called on a 32-bit system and + * @throws UnsatisfiedDependencyException if called on a 32-bit system and * `Moontoast\Math\BigNumber` is not present - * @throws \InvalidArgumentException - * @throws \Exception if it was not possible to gather sufficient entropy + * @throws InvalidArgumentException + * @throws Exception if it was not possible to gather sufficient entropy */ public function generate($node = null, $clockSeq = null) { @@ -96,14 +99,14 @@ class DefaultTimeGenerator implements TimeGeneratorInterface $hex = vsprintf( '%08s%04s%04s%02s%02s%012s', - array( + [ $uuidTime['low'], $uuidTime['mid'], sprintf('%04x', $timeHi), sprintf('%02x', $clockSeqHi), sprintf('%02x', $clockSeq & 0xff), $node, - ) + ] ); return hex2bin($hex); @@ -115,8 +118,8 @@ class DefaultTimeGenerator implements TimeGeneratorInterface * * @param string|int $node A node value that may be used to override the node provider * @return string Hexadecimal representation of the node ID - * @throws \InvalidArgumentException - * @throws \Exception + * @throws InvalidArgumentException + * @throws Exception */ protected function getValidNode($node) { @@ -130,7 +133,7 @@ class DefaultTimeGenerator implements TimeGeneratorInterface } if (!ctype_xdigit($node) || strlen($node) > 12) { - throw new \InvalidArgumentException('Invalid node value'); + throw new InvalidArgumentException('Invalid node value'); } return strtolower(sprintf('%012s', $node)); diff --git a/vendor/ramsey/uuid/src/Generator/MtRandGenerator.php b/vendor/ramsey/uuid/src/Generator/MtRandGenerator.php index f58b78357..8d4b5f9b9 100644 --- a/vendor/ramsey/uuid/src/Generator/MtRandGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/MtRandGenerator.php @@ -18,6 +18,10 @@ namespace Ramsey\Uuid\Generator; * MtRandRandomGenerator provides functionality to generate strings of random * binary data using the `mt_rand()` PHP function * + * @deprecated The mt_rand() function is not a reliable source of randomness. + * The default RandomBytesGenerator, which uses the random_bytes() function, + * is recommended as the safest and most reliable source of randomness. + * <em>This generator will be removed in ramsey/uuid 4.0.0.</em> * @link http://php.net/mt_rand */ class MtRandGenerator implements RandomGeneratorInterface diff --git a/vendor/ramsey/uuid/src/Generator/OpenSslGenerator.php b/vendor/ramsey/uuid/src/Generator/OpenSslGenerator.php index e8ec6a4d8..47abf9bb5 100644 --- a/vendor/ramsey/uuid/src/Generator/OpenSslGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/OpenSslGenerator.php @@ -21,6 +21,11 @@ namespace Ramsey\Uuid\Generator; * The use of this generator requires PHP to be compiled using the * `--with-openssl` option. * + * @deprecated The openssl_random_pseudo_bytes() function is not a reliable + * source of randomness. The default RandomBytesGenerator, which uses the + * random_bytes() function, is recommended as the safest and most reliable + * source of randomness. + * <em>This generator will be removed in ramsey/uuid 4.0.0.</em> * @link http://php.net/openssl_random_pseudo_bytes */ class OpenSslGenerator implements RandomGeneratorInterface diff --git a/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php b/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php index aaa285df0..cc3d37989 100644 --- a/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php @@ -14,6 +14,8 @@ namespace Ramsey\Uuid\Generator; +use Exception; + /** * RandomBytesGenerator provides functionality to generate strings of random * binary data using `random_bytes()` function in PHP 7+ or paragonie/random_compat @@ -28,7 +30,7 @@ class RandomBytesGenerator implements RandomGeneratorInterface * * @param integer $length The number of bytes of random binary data to generate * @return string A binary string - * @throws \Exception if it was not possible to gather sufficient entropy + * @throws Exception if it was not possible to gather sufficient entropy */ public function generate($length) { diff --git a/vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php b/vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php index 3a1bcae7e..b791d60d4 100644 --- a/vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php +++ b/vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php @@ -14,6 +14,10 @@ namespace Ramsey\Uuid\Generator; +use Exception; +use InvalidArgumentException; +use Ramsey\Uuid\Exception\UnsatisfiedDependencyException; + /** * RandomGeneratorInterface provides functionality to generate strings of random * binary data @@ -25,9 +29,9 @@ interface RandomGeneratorInterface * * @param integer $length The number of bytes of random binary data to generate * @return string A binary string - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present - * @throws \InvalidArgumentException - * @throws \Exception if it was not possible to gather sufficient entropy + * @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws InvalidArgumentException + * @throws Exception if it was not possible to gather sufficient entropy */ public function generate($length); } diff --git a/vendor/ramsey/uuid/src/Generator/RandomLibAdapter.php b/vendor/ramsey/uuid/src/Generator/RandomLibAdapter.php index 25b54a834..5aa0e8865 100644 --- a/vendor/ramsey/uuid/src/Generator/RandomLibAdapter.php +++ b/vendor/ramsey/uuid/src/Generator/RandomLibAdapter.php @@ -19,9 +19,9 @@ use RandomLib\Factory; /** * RandomLibAdapter provides functionality to generate strings of random - * binary data using the ircmaxell/random-lib library + * binary data using the paragonie/random-lib library * - * @link https://packagist.org/packages/ircmaxell/random-lib + * @link https://packagist.org/packages/paragonie/random-lib */ class RandomLibAdapter implements RandomGeneratorInterface { @@ -33,10 +33,10 @@ class RandomLibAdapter implements RandomGeneratorInterface /** * Constructs a `RandomLibAdapter` using a `RandomLib\Generator` * - * By default, if no `Generator` is passed in, this creates a medium-strength + * By default, if no `Generator` is passed in, this creates a high-strength * generator to use when generating random binary data. * - * @param Generator $generator An ircmaxell/random-lib `Generator` + * @param Generator $generator An paragonie/random-lib `Generator` */ public function __construct(Generator $generator = null) { @@ -45,7 +45,7 @@ class RandomLibAdapter implements RandomGeneratorInterface if ($this->generator === null) { $factory = new Factory(); - $this->generator = $factory->getMediumStrengthGenerator(); + $this->generator = $factory->getHighStrengthGenerator(); } } diff --git a/vendor/ramsey/uuid/src/Generator/SodiumRandomGenerator.php b/vendor/ramsey/uuid/src/Generator/SodiumRandomGenerator.php index 6b08f5402..f4ccf8593 100644 --- a/vendor/ramsey/uuid/src/Generator/SodiumRandomGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/SodiumRandomGenerator.php @@ -18,6 +18,11 @@ namespace Ramsey\Uuid\Generator; * SodiumRandomGenerator provides functionality to generate strings of random * binary data using the PECL libsodium extension * + * @deprecated As of PHP 7.2.0, the libsodium extension is bundled with PHP, and + * the random_bytes() PHP function is now the recommended method for + * generating random byes. The default RandomBytesGenerator uses the + * random_bytes() function. + * <em>This generator will be removed in ramsey/uuid 4.0.0.</em> * @link http://pecl.php.net/package/libsodium * @link https://paragonie.com/book/pecl-libsodium */ diff --git a/vendor/ramsey/uuid/src/Generator/TimeGeneratorInterface.php b/vendor/ramsey/uuid/src/Generator/TimeGeneratorInterface.php index cb182ea00..27c74590f 100644 --- a/vendor/ramsey/uuid/src/Generator/TimeGeneratorInterface.php +++ b/vendor/ramsey/uuid/src/Generator/TimeGeneratorInterface.php @@ -14,6 +14,10 @@ namespace Ramsey\Uuid\Generator; +use Exception; +use InvalidArgumentException; +use Ramsey\Uuid\Exception\UnsatisfiedDependencyException; + /** * TimeGeneratorInterface provides functionality to generate strings of binary * data for version 1 UUIDs based on a host ID, sequence number, and the current @@ -30,10 +34,10 @@ interface TimeGeneratorInterface * could arise when the clock is set backwards in time or if the node ID * changes. * @return string A binary string - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called on a 32-bit system and + * @throws UnsatisfiedDependencyException if called on a 32-bit system and * `Moontoast\Math\BigNumber` is not present - * @throws \InvalidArgumentException - * @throws \Exception if it was not possible to gather sufficient entropy + * @throws InvalidArgumentException + * @throws Exception if it was not possible to gather sufficient entropy */ public function generate($node = null, $clockSeq = null); } diff --git a/vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php b/vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php index 289fddeae..83488ab96 100644 --- a/vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php +++ b/vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php @@ -14,6 +14,7 @@ namespace Ramsey\Uuid\Provider\Node; +use Exception; use Ramsey\Uuid\Provider\NodeProviderInterface; /** @@ -43,7 +44,7 @@ class FallbackNodeProvider implements NodeProviderInterface * and returning the first non-empty value found * * @return string System node ID as a hexadecimal string - * @throws \Exception + * @throws Exception */ public function getNode() { diff --git a/vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php b/vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php index 76c570d7f..79ec63cb8 100644 --- a/vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php +++ b/vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php @@ -14,6 +14,7 @@ namespace Ramsey\Uuid\Provider\Node; +use Exception; use Ramsey\Uuid\Provider\NodeProviderInterface; /** @@ -28,15 +29,29 @@ class RandomNodeProvider implements NodeProviderInterface * Returns the system node ID * * @return string System node ID as a hexadecimal string - * @throws \Exception if it was not possible to gather sufficient entropy + * @throws Exception if it was not possible to gather sufficient entropy */ public function getNode() { - $node = hexdec(bin2hex(random_bytes(6))); + $nodeBytes = random_bytes(6); + + // Split the node bytes for math on 32-bit systems. + $nodeMsb = substr($nodeBytes, 0, 3); + $nodeLsb = substr($nodeBytes, 3); // Set the multicast bit; see RFC 4122, section 4.5. - $node = $node | 0x010000000000; + $nodeMsb = hex2bin( + str_pad( + dechex(hexdec(bin2hex($nodeMsb)) | 0x010000), + 6, + '0', + STR_PAD_LEFT + ) + ); + + // Recombine the node bytes. + $node = $nodeMsb . $nodeLsb; - return str_pad(dechex($node), 12, '0', STR_PAD_LEFT); + return str_pad(bin2hex($node), 12, '0', STR_PAD_LEFT); } } diff --git a/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php b/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php index ae6a09eaa..57015133a 100644 --- a/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php +++ b/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php @@ -36,7 +36,7 @@ class SystemNodeProvider implements NodeProviderInterface } $pattern = '/[^:]([0-9A-Fa-f]{2}([:-])[0-9A-Fa-f]{2}(\2[0-9A-Fa-f]{2}){4})[^:]/'; - $matches = array(); + $matches = []; // first try a linux specific way $node = $this->getSysfs(); @@ -67,7 +67,7 @@ class SystemNodeProvider implements NodeProviderInterface } ob_start(); - switch (strtoupper(substr(php_uname('a'), 0, 3))) { + switch (strtoupper(substr(constant('PHP_OS'), 0, 3))) { case 'WIN': passthru('ipconfig /all 2>&1'); break; @@ -95,15 +95,18 @@ class SystemNodeProvider implements NodeProviderInterface { $mac = false; - if (strtoupper(php_uname('s')) === 'LINUX') { + if (strtoupper(constant('PHP_OS')) === 'LINUX') { $addressPaths = glob('/sys/class/net/*/address', GLOB_NOSORT); if (empty($addressPaths)) { return false; } + $macs = []; array_walk($addressPaths, function ($addressPath) use (&$macs) { - $macs[] = file_get_contents($addressPath); + if (is_readable($addressPath)) { + $macs[] = file_get_contents($addressPath); + } }); $macs = array_map('trim', $macs); diff --git a/vendor/ramsey/uuid/src/Provider/NodeProviderInterface.php b/vendor/ramsey/uuid/src/Provider/NodeProviderInterface.php index 14f747bea..b6f721feb 100644 --- a/vendor/ramsey/uuid/src/Provider/NodeProviderInterface.php +++ b/vendor/ramsey/uuid/src/Provider/NodeProviderInterface.php @@ -14,6 +14,8 @@ namespace Ramsey\Uuid\Provider; +use Exception; + /** * NodeProviderInterface provides functionality to get the node ID (or host ID * in the form of the system's MAC address) from a specific type of node provider @@ -24,7 +26,7 @@ interface NodeProviderInterface * Returns the system node ID * * @return string System node ID as a hexadecimal string - * @throws \Exception if it was not possible to gather sufficient entropy + * @throws Exception if it was not possible to gather sufficient entropy */ public function getNode(); } diff --git a/vendor/ramsey/uuid/src/Provider/Time/FixedTimeProvider.php b/vendor/ramsey/uuid/src/Provider/Time/FixedTimeProvider.php index a62d39c62..79a9d04e0 100644 --- a/vendor/ramsey/uuid/src/Provider/Time/FixedTimeProvider.php +++ b/vendor/ramsey/uuid/src/Provider/Time/FixedTimeProvider.php @@ -14,6 +14,7 @@ namespace Ramsey\Uuid\Provider\Time; +use InvalidArgumentException; use Ramsey\Uuid\Provider\TimeProviderInterface; /** @@ -33,12 +34,12 @@ class FixedTimeProvider implements TimeProviderInterface * Constructs a `FixedTimeProvider` using the provided `$timestamp` * * @param int[] Array containing `sec` and `usec` components of a timestamp - * @throws \InvalidArgumentException if the `$timestamp` does not contain `sec` or `usec` components + * @throws InvalidArgumentException if the `$timestamp` does not contain `sec` or `usec` components */ public function __construct(array $timestamp) { if (!array_key_exists('sec', $timestamp) || !array_key_exists('usec', $timestamp)) { - throw new \InvalidArgumentException('Array must contain sec and usec keys.'); + throw new InvalidArgumentException('Array must contain sec and usec keys.'); } $this->fixedTime = $timestamp; diff --git a/vendor/ramsey/uuid/src/Uuid.php b/vendor/ramsey/uuid/src/Uuid.php index 45f9fa448..f2912b48a 100644 --- a/vendor/ramsey/uuid/src/Uuid.php +++ b/vendor/ramsey/uuid/src/Uuid.php @@ -14,8 +14,13 @@ namespace Ramsey\Uuid; +use DateTime; +use Exception; +use InvalidArgumentException; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Codec\CodecInterface; +use Ramsey\Uuid\Exception\InvalidUuidStringException; +use Ramsey\Uuid\Exception\UnsatisfiedDependencyException; use Ramsey\Uuid\Exception\UnsupportedOperationException; /** @@ -140,14 +145,14 @@ class Uuid implements UuidInterface * @var array * @see UuidInterface::getFieldsHex() */ - protected $fields = array( + protected $fields = [ 'time_low' => '00000000', 'time_mid' => '0000', 'time_hi_and_version' => '0000', 'clock_seq_hi_and_reserved' => '00', 'clock_seq_low' => '00', 'node' => '000000000000', - ); + ]; /** * The number converter to use for converting hex values to/from integers. @@ -229,7 +234,7 @@ class Uuid implements UuidInterface * * @param string $serialized * @link http://php.net/manual/en/class.serializable.php - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws InvalidUuidStringException */ public function unserialize($serialized) { @@ -241,28 +246,32 @@ class Uuid implements UuidInterface public function compareTo(UuidInterface $other) { - $comparison = 0; - if ($this->getMostSignificantBitsHex() < $other->getMostSignificantBitsHex()) { - $comparison = -1; - } elseif ($this->getMostSignificantBitsHex() > $other->getMostSignificantBitsHex()) { - $comparison = 1; - } elseif ($this->getLeastSignificantBitsHex() < $other->getLeastSignificantBitsHex()) { - $comparison = -1; - } elseif ($this->getLeastSignificantBitsHex() > $other->getLeastSignificantBitsHex()) { - $comparison = 1; + return -1; + } + + if ($this->getMostSignificantBitsHex() > $other->getMostSignificantBitsHex()) { + return 1; + } + + if ($this->getLeastSignificantBitsHex() < $other->getLeastSignificantBitsHex()) { + return -1; + } + + if ($this->getLeastSignificantBitsHex() > $other->getLeastSignificantBitsHex()) { + return 1; } - return $comparison; + return 0; } public function equals($other) { - if (!($other instanceof UuidInterface)) { + if (!$other instanceof UuidInterface) { return false; } - return ($this->compareTo($other) == 0); + return $this->compareTo($other) == 0; } public function getBytes() @@ -319,8 +328,7 @@ class Uuid implements UuidInterface */ public function getClockSequence() { - return (($this->getClockSeqHiAndReserved() & 0x3f) << 8) - | $this->getClockSeqLow(); + return ($this->getClockSeqHiAndReserved() & 0x3f) << 8 | $this->getClockSeqLow(); } public function getClockSequenceHex() @@ -342,10 +350,10 @@ class Uuid implements UuidInterface throw new UnsupportedOperationException('Not a time-based UUID'); } - $unixTime = ($this->getTimestamp() - 0x01b21dd213814000) / 1e7; - $unixTime = number_format($unixTime, 0, '', ''); + $unixTimeNanoseconds = $this->getTimestamp() - 0x01b21dd213814000; + $unixTime = ($unixTimeNanoseconds - $unixTimeNanoseconds % 1e7) / 1e7; - return new \DateTime("@{$unixTime}"); + return new DateTime("@{$unixTime}"); } /** @@ -368,14 +376,14 @@ class Uuid implements UuidInterface */ public function getFields() { - return array( + return [ 'time_low' => $this->getTimeLow(), 'time_mid' => $this->getTimeMid(), 'time_hi_and_version' => $this->getTimeHiAndVersion(), 'clock_seq_hi_and_reserved' => $this->getClockSeqHiAndReserved(), 'clock_seq_low' => $this->getClockSeqLow(), 'node' => $this->getNode(), - ); + ]; } public function getFieldsHex() @@ -400,7 +408,7 @@ class Uuid implements UuidInterface * Returns the least significant 64 bits of this UUID's 128 bit value. * * @return mixed Converted representation of the unsigned 64-bit integer value - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present */ public function getLeastSignificantBits() { @@ -421,7 +429,7 @@ class Uuid implements UuidInterface * Returns the most significant 64 bits of this UUID's 128 bit value. * * @return mixed Converted representation of the unsigned 64-bit integer value - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present */ public function getMostSignificantBits() { @@ -568,17 +576,20 @@ class Uuid implements UuidInterface public function getVariant() { $clockSeq = $this->getClockSeqHiAndReserved(); + if (0 === ($clockSeq & 0x80)) { - $variant = self::RESERVED_NCS; - } elseif (0 === ($clockSeq & 0x40)) { - $variant = self::RFC_4122; - } elseif (0 === ($clockSeq & 0x20)) { - $variant = self::RESERVED_MICROSOFT; - } else { - $variant = self::RESERVED_FUTURE; + return self::RESERVED_NCS; + } + + if (0 === ($clockSeq & 0x40)) { + return self::RFC_4122; + } + + if (0 === ($clockSeq & 0x20)) { + return self::RESERVED_MICROSOFT; } - return $variant; + return self::RESERVED_FUTURE; } public function getVersion() @@ -624,8 +635,8 @@ class Uuid implements UuidInterface * * @param string $bytes * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException - * @throws \InvalidArgumentException + * @throws InvalidUuidStringException + * @throws InvalidArgumentException */ public static function fromBytes($bytes) { @@ -637,7 +648,7 @@ class Uuid implements UuidInterface * * @param string $name A string that specifies a UUID * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws InvalidUuidStringException */ public static function fromString($name) { @@ -649,8 +660,8 @@ class Uuid implements UuidInterface * * @param string $integer String representation of 128-bit integer * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws InvalidUuidStringException */ public static function fromInteger($integer) { @@ -665,7 +676,7 @@ class Uuid implements UuidInterface */ public static function isValid($uuid) { - $uuid = str_replace(array('urn:', 'uuid:', '{', '}'), '', $uuid); + $uuid = str_replace(['urn:', 'uuid:', 'URN:', 'UUID:', '{', '}'], '', $uuid); if ($uuid == self::NIL) { return true; @@ -687,10 +698,10 @@ class Uuid implements UuidInterface * could arise when the clock is set backwards in time or if the node ID * changes. * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called on a 32-bit system and + * @throws UnsatisfiedDependencyException if called on a 32-bit system and * `Moontoast\Math\BigNumber` is not present - * @throws \InvalidArgumentException - * @throws \Exception if it was not possible to gather sufficient entropy + * @throws InvalidArgumentException + * @throws Exception if it was not possible to gather sufficient entropy */ public static function uuid1($node = null, $clockSeq = null) { @@ -701,10 +712,10 @@ class Uuid implements UuidInterface * Generate a version 3 UUID based on the MD5 hash of a namespace identifier * (which is a UUID) and a name (which is a string). * - * @param string $ns The UUID namespace in which to create the named UUID + * @param string|UuidInterface $ns The UUID namespace in which to create the named UUID * @param string $name The name to create a UUID for * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws InvalidUuidStringException */ public static function uuid3($ns, $name) { @@ -715,9 +726,9 @@ class Uuid implements UuidInterface * Generate a version 4 (random) UUID. * * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present - * @throws \InvalidArgumentException - * @throws \Exception + * @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws InvalidArgumentException + * @throws Exception */ public static function uuid4() { @@ -728,10 +739,10 @@ class Uuid implements UuidInterface * Generate a version 5 UUID based on the SHA-1 hash of a namespace * identifier (which is a UUID) and a name (which is a string). * - * @param string $ns The UUID namespace in which to create the named UUID + * @param string|UuidInterface $ns The UUID namespace in which to create the named UUID * @param string $name The name to create a UUID for * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws InvalidUuidStringException */ public static function uuid5($ns, $name) { diff --git a/vendor/ramsey/uuid/src/UuidFactory.php b/vendor/ramsey/uuid/src/UuidFactory.php index 99644d4b4..5a57b09b2 100644 --- a/vendor/ramsey/uuid/src/UuidFactory.php +++ b/vendor/ramsey/uuid/src/UuidFactory.php @@ -15,6 +15,7 @@ namespace Ramsey\Uuid; use Ramsey\Uuid\Converter\NumberConverterInterface; +use Ramsey\Uuid\Exception\InvalidUuidStringException; use Ramsey\Uuid\Provider\NodeProviderInterface; use Ramsey\Uuid\Generator\RandomGeneratorInterface; use Ramsey\Uuid\Generator\TimeGeneratorInterface; @@ -274,7 +275,7 @@ class UuidFactory implements UuidFactoryInterface * @param string $hashFunction The hash function to use when hashing together * the namespace and name * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws InvalidUuidStringException */ protected function uuidFromNsAndName($ns, $name, $version, $hashFunction) { @@ -300,14 +301,14 @@ class UuidFactory implements UuidFactoryInterface $timeHi = BinaryUtils::applyVersion(substr($hash, 12, 4), $version); $clockSeqHi = BinaryUtils::applyVariant(hexdec(substr($hash, 16, 2))); - $fields = array( + $fields = [ 'time_low' => substr($hash, 0, 8), 'time_mid' => substr($hash, 8, 4), 'time_hi_and_version' => str_pad(dechex($timeHi), 4, '0', STR_PAD_LEFT), 'clock_seq_hi_and_reserved' => str_pad(dechex($clockSeqHi), 2, '0', STR_PAD_LEFT), 'clock_seq_low' => substr($hash, 18, 2), 'node' => substr($hash, 20, 12), - ); + ]; return $this->uuid($fields); } diff --git a/vendor/ramsey/uuid/src/UuidFactoryInterface.php b/vendor/ramsey/uuid/src/UuidFactoryInterface.php index a228f5bc7..1c1651d64 100644 --- a/vendor/ramsey/uuid/src/UuidFactoryInterface.php +++ b/vendor/ramsey/uuid/src/UuidFactoryInterface.php @@ -14,6 +14,11 @@ namespace Ramsey\Uuid; +use Exception; +use InvalidArgumentException; +use Ramsey\Uuid\Exception\InvalidUuidStringException; +use Ramsey\Uuid\Exception\UnsatisfiedDependencyException; + /** * UuidFactoryInterface defines common functionality all `UuidFactory` instances * must implement @@ -29,10 +34,10 @@ interface UuidFactoryInterface * could arise when the clock is set backwards in time or if the node ID * changes. * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called on a 32-bit system and + * @throws UnsatisfiedDependencyException if called on a 32-bit system and * `Moontoast\Math\BigNumber` is not present - * @throws \InvalidArgumentException - * @throws \Exception if it was not possible to gather sufficient entropy + * @throws InvalidArgumentException + * @throws Exception if it was not possible to gather sufficient entropy */ public function uuid1($node = null, $clockSeq = null); @@ -40,10 +45,10 @@ interface UuidFactoryInterface * Generate a version 3 UUID based on the MD5 hash of a namespace identifier * (which is a UUID) and a name (which is a string). * - * @param string $ns The UUID namespace in which to create the named UUID + * @param string|UuidInterface $ns The UUID namespace in which to create the named UUID * @param string $name The name to create a UUID for * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws InvalidUuidStringException */ public function uuid3($ns, $name); @@ -51,9 +56,9 @@ interface UuidFactoryInterface * Generate a version 4 (random) UUID. * * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present - * @throws \InvalidArgumentException - * @throws \Exception + * @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws InvalidArgumentException + * @throws Exception */ public function uuid4(); @@ -61,10 +66,10 @@ interface UuidFactoryInterface * Generate a version 5 UUID based on the SHA-1 hash of a namespace * identifier (which is a UUID) and a name (which is a string). * - * @param string $ns The UUID namespace in which to create the named UUID + * @param string|UuidInterface $ns The UUID namespace in which to create the named UUID * @param string $name The name to create a UUID for * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws InvalidUuidStringException */ public function uuid5($ns, $name); @@ -73,8 +78,8 @@ interface UuidFactoryInterface * * @param string $bytes A 16-byte string representation of a UUID * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException - * @throws \InvalidArgumentException if string has not 16 characters + * @throws InvalidUuidStringException + * @throws InvalidArgumentException if string has not 16 characters */ public function fromBytes($bytes); @@ -83,7 +88,7 @@ interface UuidFactoryInterface * * @param string $uuid A string representation of a UUID * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws InvalidUuidStringException */ public function fromString($uuid); @@ -96,8 +101,8 @@ interface UuidFactoryInterface * @param mixed $integer The integer to use when creating a `Uuid` from an * integer; may be of any type understood by the configured number converter * @return UuidInterface - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present - * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws InvalidUuidStringException */ public function fromInteger($integer); } diff --git a/vendor/ramsey/uuid/src/UuidInterface.php b/vendor/ramsey/uuid/src/UuidInterface.php index ea3a46fb2..42a3ad7ff 100644 --- a/vendor/ramsey/uuid/src/UuidInterface.php +++ b/vendor/ramsey/uuid/src/UuidInterface.php @@ -14,14 +14,18 @@ namespace Ramsey\Uuid; +use DateTime; +use JsonSerializable; use Ramsey\Uuid\Converter\NumberConverterInterface; +use Ramsey\Uuid\Exception\UnsatisfiedDependencyException; use Ramsey\Uuid\Exception\UnsupportedOperationException; +use Serializable; /** * UuidInterface defines common functionality for all universally unique * identifiers (UUIDs) */ -interface UuidInterface extends \JsonSerializable, \Serializable +interface UuidInterface extends JsonSerializable, Serializable { /** * Compares this UUID to the specified UUID. @@ -121,9 +125,9 @@ interface UuidInterface extends \JsonSerializable, \Serializable * has version type 1. If this UUID is not a time-based UUID then * this method throws `UnsupportedOperationException`. * - * @return \DateTime A PHP DateTime representation of the date + * @return DateTime A PHP DateTime representation of the date * @throws UnsupportedOperationException If this UUID is not a version 1 UUID - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called in a 32-bit system and + * @throws UnsatisfiedDependencyException if called in a 32-bit system and * `Moontoast\Math\BigNumber` is not present */ public function getDateTime(); @@ -133,7 +137,7 @@ interface UuidInterface extends \JsonSerializable, \Serializable * representation. * * @return mixed Converted representation of the unsigned 128-bit integer value - * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present */ public function getInteger(); diff --git a/vendor/ramsey/uuid/src/functions.php b/vendor/ramsey/uuid/src/functions.php new file mode 100644 index 000000000..b5db34183 --- /dev/null +++ b/vendor/ramsey/uuid/src/functions.php @@ -0,0 +1,78 @@ +<?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 + */ + +namespace Ramsey\Uuid; + +use Exception; +use InvalidArgumentException; +use Ramsey\Uuid\Exception\InvalidUuidStringException; +use Ramsey\Uuid\Exception\UnsatisfiedDependencyException; + +/** + * Generate a version 1 UUID from a host ID, sequence number, and the current time. + * + * @param int|string|null $node A 48-bit number representing the hardware address + * This number may be represented as an integer or a hexadecimal string. + * @param int|null $clockSeq A 14-bit number used to help avoid duplicates that + * could arise when the clock is set backwards in time or if the node ID + * changes. + * @return string + * @throws UnsatisfiedDependencyException if called on a 32-bit system and + * `Moontoast\Math\BigNumber` is not present + * @throws InvalidArgumentException + * @throws Exception if it was not possible to gather sufficient entropy + */ +function v1($node = null, $clockSeq = null) +{ + return Uuid::uuid1($node, $clockSeq)->toString(); +} + +/** + * Generate a version 3 UUID based on the MD5 hash of a namespace identifier + * (which is a UUID) and a name (which is a string). + * + * @param string|UuidInterface $ns The UUID namespace in which to create the named UUID + * @param string $name The name to create a UUID for + * @return string + * @throws InvalidUuidStringException + */ +function v3($ns, $name) +{ + return Uuid::uuid3($ns, $name)->toString(); +} + +/** + * Generate a version 4 (random) UUID. + * + * @return string + * @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws InvalidArgumentException + * @throws Exception + */ +function v4() +{ + return Uuid::uuid4()->toString(); +} + +/** + * Generate a version 5 UUID based on the SHA-1 hash of a namespace + * identifier (which is a UUID) and a name (which is a string). + * + * @param string|UuidInterface $ns The UUID namespace in which to create the named UUID + * @param string $name The name to create a UUID for + * @return string + * @throws InvalidUuidStringException + */ +function v5($ns, $name) +{ + return Uuid::uuid5($ns, $name)->toString(); +} |