diff options
author | Mario <mario@mariovavti.com> | 2020-11-27 08:04:00 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-11-27 08:04:00 +0000 |
commit | f4bb7bcbff3770387c2fecfa91ce4a60b916a474 (patch) | |
tree | ea007e664d435f1f3d63c87bfe1600484d2bd46c /vendor/ramsey/uuid/src/Builder/DegradedUuidBuilder.php | |
parent | 07e5b8295ea9d342f66d8119d88bd58124b548e6 (diff) | |
download | volse-hubzilla-f4bb7bcbff3770387c2fecfa91ce4a60b916a474.tar.gz volse-hubzilla-f4bb7bcbff3770387c2fecfa91ce4a60b916a474.tar.bz2 volse-hubzilla-f4bb7bcbff3770387c2fecfa91ce4a60b916a474.zip |
update composer libs
Diffstat (limited to 'vendor/ramsey/uuid/src/Builder/DegradedUuidBuilder.php')
-rw-r--r-- | vendor/ramsey/uuid/src/Builder/DegradedUuidBuilder.php | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/vendor/ramsey/uuid/src/Builder/DegradedUuidBuilder.php b/vendor/ramsey/uuid/src/Builder/DegradedUuidBuilder.php index 7edb6deb7..23931e416 100644 --- a/vendor/ramsey/uuid/src/Builder/DegradedUuidBuilder.php +++ b/vendor/ramsey/uuid/src/Builder/DegradedUuidBuilder.php @@ -1,4 +1,5 @@ <?php + /** * This file is part of the ramsey/uuid library * @@ -7,47 +8,69 @@ * * @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\Builder; use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; +use Ramsey\Uuid\Converter\Time\DegradedTimeConverter; +use Ramsey\Uuid\Converter\TimeConverterInterface; use Ramsey\Uuid\DegradedUuid; +use Ramsey\Uuid\Rfc4122\Fields as Rfc4122Fields; +use Ramsey\Uuid\UuidInterface; /** - * DegradedUuidBuilder builds instances of DegradedUuid + * @deprecated DegradedUuid instances are no longer necessary to support 32-bit + * systems. Transition to {@see DefaultUuidBuilder}. + * + * @psalm-immutable */ class DegradedUuidBuilder implements UuidBuilderInterface { /** * @var NumberConverterInterface */ - private $converter; + private $numberConverter; /** - * Constructs the DegradedUuidBuilder - * - * @param NumberConverterInterface $converter The number converter to use when constructing the DegradedUuid + * @var TimeConverterInterface */ - public function __construct(NumberConverterInterface $converter) - { - $this->converter = $converter; + private $timeConverter; + + /** + * @param NumberConverterInterface $numberConverter The number converter to + * use when constructing the DegradedUuid + * @param TimeConverterInterface|null $timeConverter The time converter to use + * for converting timestamps extracted from a UUID to Unix timestamps + */ + public function __construct( + NumberConverterInterface $numberConverter, + ?TimeConverterInterface $timeConverter = null + ) { + $this->numberConverter = $numberConverter; + $this->timeConverter = $timeConverter ?: new DegradedTimeConverter(); } /** - * Builds a DegradedUuid + * Builds and returns a DegradedUuid + * + * @param CodecInterface $codec The codec to use for building this DegradedUuid instance + * @param string $bytes The byte string from which to construct a UUID + * + * @return DegradedUuid The DegradedUuidBuild returns an instance of Ramsey\Uuid\DegradedUuid * - * @param CodecInterface $codec The codec to use for building this DegradedUuid - * @param array $fields An array of fields from which to construct the DegradedUuid; - * see {@see \Ramsey\Uuid\UuidInterface::getFieldsHex()} for array structure. - * @return DegradedUuid + * @psalm-pure */ - public function build(CodecInterface $codec, array $fields) + public function build(CodecInterface $codec, string $bytes): UuidInterface { - return new DegradedUuid($fields, $this->converter, $codec); + return new DegradedUuid( + new Rfc4122Fields($bytes), + $this->numberConverter, + $codec, + $this->timeConverter + ); } } |