Server IP : 213.176.29.180 / Your IP : 3.144.10.134 Web Server : Apache System : Linux 213.176.29.180.hostiran.name 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64 User : webtaragh ( 1001) PHP Version : 8.3.14 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0750) : /home/webtaragh/public_html/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
PK ��$Z�OL�� � uuid/CONTRIBUTING.mdnu �[��� # Contributing Contributions are welcome. We accept pull requests on [GitHub](https://github.com/ramsey/uuid). This project adheres to a [Contributor Code of Conduct](https://github.com/ramsey/uuid/blob/master/CODE_OF_CONDUCT.md). By participating in this project and its community, you are expected to uphold this code. ## Team members * [Ben Ramsey](https://github.com/ramsey) - original author and maintainer * [Marijn Huizendveld](https://github.com/marijn) - contributor, author of UUID type definition for Doctrine DBAL * [Thibaud Fabre](https://github.com/aztech-dev) - contributor, lead developer for version 3.0.0 re-architecture ## Communication Channels You can find help and discussion in the following places: * Gitter chat: <https://gitter.im/ramsey/uuid> * GitHub Issues: <https://github.com/ramsey/uuid/issues> * Wiki: <https://github.com/ramsey/uuid/wiki> ## Reporting Bugs Bugs are tracked in our project's [issue tracker](https://github.com/ramsey/uuid/issues). When submitting a bug report, please include enough information for us to reproduce the bug. A good bug report includes the following sections: * Expected outcome * Actual outcome * Steps to reproduce, including sample code * Any other information that will help us debug and reproduce the issue, including stack traces, system/environment information, and screenshots **Please do not include passwords or any personally identifiable information in your bug report and sample code.** ## Fixing Bugs We welcome pull requests to fix bugs! If you see a bug report that you'd like to fix, please feel free to do so. Following the directions and guidelines described in the "Adding New Features" section below, you may create bugfix branches and send us pull requests. ## Adding New Features If you have an idea for a new feature, it's a good idea to check out our [issues](https://github.com/ramsey/uuid/issues) or active [pull requests](https://github.com/ramsey/uuid/pulls) first to see if the feature is already being worked on. If not, feel free to submit an issue first, asking whether the feature is beneficial to the project. This will save you from doing a lot of development work only to have your feature rejected. We don't enjoy rejecting your hard work, but some features just don't fit with the goals of the project. When you do begin working on your feature, here are some guidelines to consider: * Your pull request description should clearly detail the changes you have made. We will use this description to add to our CHANGELOG. If there is no description or it does not adequately describe your feature, we will ask you to update the description. * We following the **[PSR-2 coding standard](http://www.php-fig.org/psr/psr-2/)**. Please ensure your code does, too. * Please **write tests** for any new features you add. * Please **ensure that tests pass** before submitting your pull request. We have Travis CI automatically running tests for pull requests. However, running the tests locally will help save time. * **Use topic/feature branches.** Please do not ask us to pull from your master branch. * **Submit one feature per pull request.** If you have multiple features you wish to submit, please break them up into separate pull requests. * **Send coherent history**. Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting. ## Running Tests The following tests must pass before we will accept a pull request. If any of these do not pass, it will result in a complete build failure. Before you can run these, be sure to `composer install`. ``` ./vendor/bin/parallel-lint src tests ./vendor/bin/phpcs src tests --standard=psr2 -sp ./vendor/bin/phpunit --verbose ``` ### Locally Test With Emulated MIPS Architecture The following commands use [Vagrant](https://www.vagrantup.com/) to start an Ubuntu VM, install necessary dependencies, and then run the `util/run-tests.sh` script that will download a Docker image emulating the MIPS architecture. This is especially helpful for testing UUID generation in a big-endian environment. ``` vagrant init ubuntu/trusty64 vagrant up vagrant ssh sudo apt-get install docker.io qemu-user-static php5-cli php5-curl cd /vagrant curl -sS https://getcomposer.org/installer | php php composer.phar install --no-interaction --prefer-dist mkdir -p build/logs ARCH=mips PHP_VERSION=5.6.14 TRAVIS_BUILD_DIR=/vagrant ./util/run-tests.sh ``` PK ��$Z�L�� � uuid/.readthedocs.ymlnu �[��� version: 2 sphinx: configuration: docs/conf.py formats: all python: version: 3.7 install: - requirements: docs/requirements.txt PK ��$ZB��~� � uuid/util/hhvm-docker/Dockerfilenu �[��� FROM benramsey/hhvm-dev:3.12.0 RUN apt-get update -y && apt-get install -y build-essential curl wget git uuid-dev libuuid1 RUN wget https://github.com/vipsoft/hhvm-ext-uuid/archive/ba0ebae0fe.tar.gz \ && tar zxf ba0ebae0fe.tar.gz \ && cd hhvm-ext-uuid-ba0ebae0fe123e8545ea02110db2f0102c08d637/ \ && hphpize \ && cmake . \ && make \ && cp uuid.so /etc/hhvm/ext/uuid.so \ && printf "hhvm.dynamic_extensions[uuid] = uuid.so\n" >> /etc/hhvm/php.ini RUN rm ba0ebae0fe.tar.gz && rm -rf hhvm-ext-uuid-ba0ebae0fe123e8545ea02110db2f0102c08d637/ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer PK ��$Z�*�\� � uuid/util/run-tests.shnu �[��� #!/bin/bash ### Run tests based on CPU architecture # # Depending on the ARCH indicated for this test job, run the tests in a # Docker container based on the PHP version for this job. # if [ -z "${ARCH}" ]; then echo "The ARCH environment variable must be provided" exit 1 fi if [ -z "${PHP_VERSION}" ]; then echo "The PHP_VERSION environment variable must be provided" exit 1 fi if [ -z "${TRAVIS_BUILD_DIR}" ]; then echo "The TRAVIS_BUILD_DIR environment variable must be provided" exit 1 fi if [ "${PHP_VERSION}" = "hhvm" ]; then docker_tag="${ARCH}-trusty-php-${PHP_VERSION}" else docker_tag="${ARCH}-wheezy-php-${PHP_VERSION}" fi declare -a commands commands[0]="echo \"Environment: \$(uname -a)\"" commands[1]="php --version" commands[2]="cd ${TRAVIS_BUILD_DIR}" commands[3]="composer install --no-interaction --prefer-dist" commands[4]="./vendor/bin/parallel-lint src tests" commands[5]="./vendor/bin/phpcs src tests --standard=psr2 -sp" commands[6]="./vendor/bin/phpunit --verbose --coverage-clover build/logs/clover.xml" printf -v command "%s && " "${commands[@]}" command=${command::-4} sudo docker run -v "${TRAVIS_BUILD_DIR}":"${TRAVIS_BUILD_DIR}" \ benramsey/ramsey-uuid:$docker_tag \ bash -c "${command}" PK ��$Z�S2�t t uuid/util/build-docker-image.shnu �[��� #!/bin/bash ### Build a Docker image for a target PHP version, CPU arch, and Debian version # # Based on: https://github.com/docker-32bit/debian # # See also: # https://www.tomaz.me/2013/12/02/running-travis-ci-tests-on-arm.html # # Note: Building HHVM with this script is not supported. See instead: # https://gist.github.com/ramsey/04cb15ff955d54484980 # # Recommended approach for running this script to build Docker images: # # vagrant init ubuntu/trusty64 # vagrant up # vagrant ssh # sudo apt-get install docker.io # sudo docker login # cd /vagrant # sudo ./util/build-docker-image.sh 5.6.14 mips mips wheezy # # or (for 64-bit, standard Debian): # # sudo ./util/build-docker-image.sh 5.6.14 x86_64 amd64 wheezy # if [ $EUID -ne 0 ]; then echo "This script must be run as root" 1>&2 exit 1 fi ### settings php_version=${1:-5.6.14} qemu_arch=${2:-mips} deb_arch=${3:-mips} suite=${4:-wheezy} chroot_dir="/tmp/chroot/${qemu_arch}-${suite}-php-${php_version}" apt_mirror="http://ftp.us.debian.org/debian" docker_image="benramsey/ramsey-uuid:${qemu_arch}-${suite}-php-${php_version}" tmp_package="/tmp/${qemu_arch}-${suite}-php-${php_version}.tgz" php_package="https://secure.php.net/distributions/php-${php_version}.tar.bz2" ### make sure that the required tools are installed export DEBIAN_FRONTEND=noninteractive apt-get update apt-get install -y wget debootstrap qemu-user-static binfmt-support \ docker.io php5-cli php5-curl ### install a minbase system with debootstrap debootstrap --foreign --arch=$deb_arch $suite $chroot_dir $apt_mirror cp "/usr/bin/qemu-${qemu_arch}-static" $chroot_dir/usr/bin/ chroot $chroot_dir ./debootstrap/debootstrap --second-stage ### update the list of package sources cat <<EOF > $chroot_dir/etc/apt/sources.list deb $apt_mirror $suite main contrib non-free deb $apt_mirror $suite-updates main contrib non-free deb http://security.debian.org/ $suite/updates main contrib non-free EOF ### upgrade packages chroot $chroot_dir apt-get update -qq chroot $chroot_dir apt-get upgrade -qq -y ### locale configuration chroot $chroot_dir apt-get install -qq -y debconf chroot $chroot_dir bash -c 'echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen' chroot $chroot_dir dpkg-reconfigure locales ### install dependencies to build PHP chroot $chroot_dir apt-get --allow-unauthenticated install -qq -y \ autoconf build-essential libcurl3-openssl-dev libgmp-dev libmcrypt-dev \ libreadline-dev libxml2-dev uuid-dev curl git ### download, build, and install the PHP version needed for this chroot mkdir -p $chroot_dir/php-src cd $chroot_dir/php-src wget $php_package tar xf "php-${php_version}.tar.bz2" chroot $chroot_dir bash -c "cd /php-src/php-${php_version} && ./configure --disable-all --enable-bcmath --with-gmp --disable-cgi --enable-xml --enable-libxml --enable-dom --enable-filter --enable-ctype --enable-json --with-openssl --enable-phar --enable-hash --with-curl --enable-simplexml --enable-tokenizer --enable-xmlwriter --enable-zip" chroot $chroot_dir bash -c "cd /php-src/php-${php_version} && make && make install" chroot $chroot_dir cp "/php-src/php-${php_version}/php.ini-development" /usr/local/lib/php.ini chroot $chroot_dir bash -c 'printf "date.timezone=UTC\n" >> /usr/local/lib/php.ini' ### download, build, and install the PECL UUID extension wget https://pecl.php.net/get/uuid-1.0.4.tgz tar zxf uuid-1.0.4.tgz chroot $chroot_dir bash -c "cd /php-src/uuid-1.0.4 && phpize && ./configure && make && make install" chroot $chroot_dir bash -c 'printf "extension=uuid.so\n" >> /usr/local/lib/php.ini' ### download, build, and install the PECL libsodium extension mkdir -p $chroot_dir/libsodium-src cd $chroot_dir/libsodium-src wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.8.tar.gz tar zxf libsodium-1.0.8.tar.gz chroot $chroot_dir bash -c "cd /libsodium-src/libsodium-1.0.8 && ./configure && make && make install" cd $chroot_dir/php-src wget http://pecl.php.net/get/libsodium-1.0.2.tgz tar zxf libsodium-1.0.2.tgz chroot $chroot_dir bash -c "cd /php-src/libsodium-1.0.2 && phpize && ./configure && make && make install" chroot $chroot_dir bash -c 'printf "extension=libsodium.so\n" >> /usr/local/lib/php.ini' ### download, build, and install Xdebug wget http://xdebug.org/files/xdebug-2.4.0rc3.tgz tar zxf xdebug-2.4.0rc3.tgz chroot $chroot_dir bash -c "cd /php-src/xdebug-2.4.0RC3 && phpize && ./configure --enable-xdebug && make && make install" chroot $chroot_dir bash -c "printf \"zend_extension=\$(php -r \"echo ini_get('extension_dir');\")/xdebug.so\n\" >> /usr/local/lib/php.ini" ### globally install Composer chroot $chroot_dir bash -c "curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer" ### cleanup chroot $chroot_dir apt-get autoclean chroot $chroot_dir apt-get clean chroot $chroot_dir apt-get autoremove cd /tmp rm -rf $chroot_dir/php-src ### create a tar archive from the chroot directory tar cfz $tmp_package -C $chroot_dir . ### import this tar archive into a docker image: cat $tmp_package | docker import - $docker_image ### push image to Docker Hub docker push $docker_image ### cleanup rm $tmp_package rm -rf $chroot_dir echo "Done!" PK ��$Z���� � uuid/CODE_OF_CONDUCT.mdnu �[��� # Contributor Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainer at <ben@benramsey.com>. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/4/ PK ��$Z��0jX X $ uuid/src/DeprecatedUuidInterface.phpnu �[��� <?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; use DateTimeInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; /** * This interface encapsulates deprecated methods for ramsey/uuid; this * interface and its methods will be removed in ramsey/uuid 5.0.0. * * @psalm-immutable */ interface DeprecatedUuidInterface { /** * @deprecated This method will be removed in 5.0.0. There is no alternative * recommendation, so plan accordingly. */ public function getNumberConverter(): NumberConverterInterface; /** * @deprecated Use {@see UuidInterface::getFields()} to get a * {@see FieldsInterface} instance. * * @return string[] */ public function getFieldsHex(): array; /** * @deprecated Use {@see UuidInterface::getFields()} to get a * {@see FieldsInterface} instance. If it is a * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface} instance, you may call * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface::getClockSeqHiAndReserved()}. */ public function getClockSeqHiAndReservedHex(): string; /** * @deprecated Use {@see UuidInterface::getFields()} to get a * {@see FieldsInterface} instance. If it is a * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface} instance, you may call * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface::getClockSeqLow()}. */ public function getClockSeqLowHex(): string; /** * @deprecated Use {@see UuidInterface::getFields()} to get a * {@see FieldsInterface} instance. If it is a * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface} instance, you may call * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface::getClockSeq()}. */ public function getClockSequenceHex(): string; /** * @deprecated In ramsey/uuid version 5.0.0, this will be removed from the * interface. It is available at {@see UuidV1::getDateTime()}. */ public function getDateTime(): DateTimeInterface; /** * @deprecated This method will be removed in 5.0.0. There is no direct * alternative, but the same information may be obtained by splitting * in half the value returned by {@see UuidInterface::getHex()}. */ public function getLeastSignificantBitsHex(): string; /** * @deprecated This method will be removed in 5.0.0. There is no direct * alternative, but the same information may be obtained by splitting * in half the value returned by {@see UuidInterface::getHex()}. */ public function getMostSignificantBitsHex(): string; /** * @deprecated Use {@see UuidInterface::getFields()} to get a * {@see FieldsInterface} instance. If it is a * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface} instance, you may call * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface::getNode()}. */ public function getNodeHex(): string; /** * @deprecated Use {@see UuidInterface::getFields()} to get a * {@see FieldsInterface} instance. If it is a * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface} instance, you may call * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface::getTimeHiAndVersion()}. */ public function getTimeHiAndVersionHex(): string; /** * @deprecated Use {@see UuidInterface::getFields()} to get a * {@see FieldsInterface} instance. If it is a * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface} instance, you may call * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface::getTimeLow()}. */ public function getTimeLowHex(): string; /** * @deprecated Use {@see UuidInterface::getFields()} to get a * {@see FieldsInterface} instance. If it is a * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface} instance, you may call * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface::getTimeMid()}. */ public function getTimeMidHex(): string; /** * @deprecated Use {@see UuidInterface::getFields()} to get a * {@see FieldsInterface} instance. If it is a * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface} instance, you may call * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface::getTimestamp()}. */ public function getTimestampHex(): string; /** * @deprecated In ramsey/uuid version 5.0.0, this will be removed from this * interface. It has moved to {@see \Ramsey\Uuid\Rfc4122\UuidInterface::getUrn()}. */ public function getUrn(): string; /** * @deprecated Use {@see UuidInterface::getFields()} to get a * {@see FieldsInterface} instance. If it is a * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface} instance, you may call * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface::getVariant()}. */ public function getVariant(): ?int; /** * @deprecated Use {@see UuidInterface::getFields()} to get a * {@see FieldsInterface} instance. If it is a * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface} instance, you may call * {@see \Ramsey\Uuid\Rfc4122\FieldsInterface::getVersion()}. */ public function getVersion(): ?int; } PK ��$Zo7�М2 �2 uuid/src/UuidFactory.phpnu �[��� <?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; use DateTimeInterface; use Ramsey\Uuid\Builder\UuidBuilderInterface; use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Converter\TimeConverterInterface; use Ramsey\Uuid\Generator\DceSecurityGeneratorInterface; use Ramsey\Uuid\Generator\DefaultTimeGenerator; use Ramsey\Uuid\Generator\NameGeneratorInterface; use Ramsey\Uuid\Generator\RandomGeneratorInterface; use Ramsey\Uuid\Generator\TimeGeneratorInterface; use Ramsey\Uuid\Provider\NodeProviderInterface; use Ramsey\Uuid\Provider\Time\FixedTimeProvider; use Ramsey\Uuid\Type\Hexadecimal; use Ramsey\Uuid\Type\Integer as IntegerObject; use Ramsey\Uuid\Type\Time; use Ramsey\Uuid\Validator\ValidatorInterface; use function bin2hex; use function hex2bin; use function pack; use function str_pad; use function strtolower; use function substr; use function substr_replace; use function unpack; use const STR_PAD_LEFT; class UuidFactory implements UuidFactoryInterface { /** * @var CodecInterface */ private $codec; /** * @var DceSecurityGeneratorInterface */ private $dceSecurityGenerator; /** * @var NameGeneratorInterface */ private $nameGenerator; /** * @var NodeProviderInterface */ private $nodeProvider; /** * @var NumberConverterInterface */ private $numberConverter; /** * @var RandomGeneratorInterface */ private $randomGenerator; /** * @var TimeConverterInterface */ private $timeConverter; /** * @var TimeGeneratorInterface */ private $timeGenerator; /** * @var UuidBuilderInterface */ private $uuidBuilder; /** * @var ValidatorInterface */ private $validator; /** * @param FeatureSet $features A set of available features in the current environment */ public function __construct(?FeatureSet $features = null) { $features = $features ?: new FeatureSet(); $this->codec = $features->getCodec(); $this->dceSecurityGenerator = $features->getDceSecurityGenerator(); $this->nameGenerator = $features->getNameGenerator(); $this->nodeProvider = $features->getNodeProvider(); $this->numberConverter = $features->getNumberConverter(); $this->randomGenerator = $features->getRandomGenerator(); $this->timeConverter = $features->getTimeConverter(); $this->timeGenerator = $features->getTimeGenerator(); $this->uuidBuilder = $features->getBuilder(); $this->validator = $features->getValidator(); } /** * Returns the codec used by this factory */ public function getCodec(): CodecInterface { return $this->codec; } /** * Sets the codec to use for this factory * * @param CodecInterface $codec A UUID encoder-decoder */ public function setCodec(CodecInterface $codec): void { $this->codec = $codec; } /** * Returns the name generator used by this factory */ public function getNameGenerator(): NameGeneratorInterface { return $this->nameGenerator; } /** * Sets the name generator to use for this factory * * @param NameGeneratorInterface $nameGenerator A generator to generate * binary data, based on a namespace and name */ public function setNameGenerator(NameGeneratorInterface $nameGenerator): void { $this->nameGenerator = $nameGenerator; } /** * Returns the node provider used by this factory */ public function getNodeProvider(): NodeProviderInterface { return $this->nodeProvider; } /** * Returns the random generator used by this factory */ public function getRandomGenerator(): RandomGeneratorInterface { return $this->randomGenerator; } /** * Returns the time generator used by this factory */ public function getTimeGenerator(): TimeGeneratorInterface { return $this->timeGenerator; } /** * Sets the time generator to use for this factory * * @param TimeGeneratorInterface $generator A generator to generate binary * data, based on the time */ public function setTimeGenerator(TimeGeneratorInterface $generator): void { $this->timeGenerator = $generator; } /** * Returns the DCE Security generator used by this factory */ public function getDceSecurityGenerator(): DceSecurityGeneratorInterface { return $this->dceSecurityGenerator; } /** * Sets the DCE Security generator to use for this factory * * @param DceSecurityGeneratorInterface $generator A generator to generate * binary data, based on a local domain and local identifier */ public function setDceSecurityGenerator(DceSecurityGeneratorInterface $generator): void { $this->dceSecurityGenerator = $generator; } /** * Returns the number converter used by this factory */ public function getNumberConverter(): NumberConverterInterface { return $this->numberConverter; } /** * Sets the random generator to use for this factory * * @param RandomGeneratorInterface $generator A generator to generate binary * data, based on some random input */ public function setRandomGenerator(RandomGeneratorInterface $generator): void { $this->randomGenerator = $generator; } /** * Sets the number converter to use for this factory * * @param NumberConverterInterface $converter A converter to use for working * with large integers (i.e. integers greater than PHP_INT_MAX) */ public function setNumberConverter(NumberConverterInterface $converter): void { $this->numberConverter = $converter; } /** * Returns the UUID builder used by this factory */ public function getUuidBuilder(): UuidBuilderInterface { return $this->uuidBuilder; } /** * Sets the UUID builder to use for this factory * * @param UuidBuilderInterface $builder A builder for constructing instances * of UuidInterface */ public function setUuidBuilder(UuidBuilderInterface $builder): void { $this->uuidBuilder = $builder; } /** * @psalm-mutation-free */ public function getValidator(): ValidatorInterface { return $this->validator; } /** * Sets the validator to use for this factory * * @param ValidatorInterface $validator A validator to use for validating * whether a string is a valid UUID */ public function setValidator(ValidatorInterface $validator): void { $this->validator = $validator; } /** * @psalm-pure */ public function fromBytes(string $bytes): UuidInterface { return $this->codec->decodeBytes($bytes); } /** * @psalm-pure */ public function fromString(string $uuid): UuidInterface { $uuid = strtolower($uuid); return $this->codec->decode($uuid); } /** * @psalm-pure */ public function fromInteger(string $integer): UuidInterface { $hex = $this->numberConverter->toHex($integer); $hex = str_pad($hex, 32, '0', STR_PAD_LEFT); return $this->fromString($hex); } public function fromDateTime( DateTimeInterface $dateTime, ?Hexadecimal $node = null, ?int $clockSeq = null ): UuidInterface { $timeProvider = new FixedTimeProvider( new Time($dateTime->format('U'), $dateTime->format('u')) ); $timeGenerator = new DefaultTimeGenerator( $this->nodeProvider, $this->timeConverter, $timeProvider ); $nodeHex = $node ? $node->toString() : null; $bytes = $timeGenerator->generate($nodeHex, $clockSeq); return $this->uuidFromBytesAndVersion($bytes, 1); } /** * @inheritDoc */ public function uuid1($node = null, ?int $clockSeq = null): UuidInterface { $bytes = $this->timeGenerator->generate($node, $clockSeq); return $this->uuidFromBytesAndVersion($bytes, 1); } public function uuid2( int $localDomain, ?IntegerObject $localIdentifier = null, ?Hexadecimal $node = null, ?int $clockSeq = null ): UuidInterface { $bytes = $this->dceSecurityGenerator->generate( $localDomain, $localIdentifier, $node, $clockSeq ); return $this->uuidFromBytesAndVersion($bytes, 2); } /** * @inheritDoc * @psalm-pure */ public function uuid3($ns, string $name): UuidInterface { return $this->uuidFromNsAndName($ns, $name, 3, 'md5'); } public function uuid4(): UuidInterface { $bytes = $this->randomGenerator->generate(16); return $this->uuidFromBytesAndVersion($bytes, 4); } /** * @inheritDoc * @psalm-pure */ public function uuid5($ns, string $name): UuidInterface { return $this->uuidFromNsAndName($ns, $name, 5, 'sha1'); } public function uuid6(?Hexadecimal $node = null, ?int $clockSeq = null): UuidInterface { $nodeHex = $node ? $node->toString() : null; $bytes = $this->timeGenerator->generate($nodeHex, $clockSeq); // Rearrange the bytes, according to the UUID version 6 specification. $v6 = $bytes[6] . $bytes[7] . $bytes[4] . $bytes[5] . $bytes[0] . $bytes[1] . $bytes[2] . $bytes[3]; $v6 = bin2hex($v6); // Drop the first four bits, while adding an empty four bits for the // version field. This allows us to reconstruct the correct time from // the bytes of this UUID. $v6Bytes = hex2bin(substr($v6, 1, 12) . '0' . substr($v6, -3)); $v6Bytes .= substr($bytes, 8); return $this->uuidFromBytesAndVersion($v6Bytes, 6); } /** * Returns a Uuid created from the provided byte string * * Uses the configured builder and codec and the provided byte string to * construct a Uuid object. * * @param string $bytes The byte string from which to construct a UUID * * @return UuidInterface An instance of UuidInterface, created from the * provided bytes * * @psalm-pure */ public function uuid(string $bytes): UuidInterface { return $this->uuidBuilder->build($this->codec, $bytes); } /** * Returns a version 3 or 5 namespaced Uuid * * @param string|UuidInterface $ns The namespace (must be a valid UUID) * @param string $name The name to hash together with the namespace * @param int $version The version of UUID to create (3 or 5) * @param string $hashAlgorithm The hashing algorithm to use when hashing * together the namespace and name * * @return UuidInterface An instance of UuidInterface, created by hashing * together the provided namespace and name * * @psalm-pure */ private function uuidFromNsAndName($ns, string $name, int $version, string $hashAlgorithm): UuidInterface { if (!($ns instanceof UuidInterface)) { $ns = $this->fromString($ns); } $bytes = $this->nameGenerator->generate($ns, $name, $hashAlgorithm); return $this->uuidFromBytesAndVersion(substr($bytes, 0, 16), $version); } /** * Returns an RFC 4122 variant Uuid, created from the provided bytes and version * * @param string $bytes The byte string to convert to a UUID * @param int $version The RFC 4122 version to apply to the UUID * * @return UuidInterface An instance of UuidInterface, created from the * byte string and version * * @psalm-pure */ private function uuidFromBytesAndVersion(string $bytes, int $version): UuidInterface { $timeHi = (int) unpack('n*', substr($bytes, 6, 2))[1]; $timeHiAndVersion = pack('n*', BinaryUtils::applyVersion($timeHi, $version)); $clockSeqHi = (int) unpack('n*', substr($bytes, 8, 2))[1]; $clockSeqHiAndReserved = pack('n*', BinaryUtils::applyVariant($clockSeqHi)); $bytes = substr_replace($bytes, $timeHiAndVersion, 6, 2); $bytes = substr_replace($bytes, $clockSeqHiAndReserved, 8, 2); return $this->uuid($bytes); } } PK ��$Z�݁�� � uuid/src/BinaryUtils.phpnu �[��� <?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; /** * Provides binary math utilities */ class BinaryUtils { /** * Applies the RFC 4122 variant field to the 16-bit clock sequence * * @link http://tools.ietf.org/html/rfc4122#section-4.1.1 RFC 4122, § 4.1.1: Variant * * @param int $clockSeq The 16-bit clock sequence value before the RFC 4122 * variant is applied * * @return int The 16-bit clock sequence multiplexed with the UUID variant * * @psalm-pure */ public static function applyVariant(int $clockSeq): int { $clockSeq = $clockSeq & 0x3fff; $clockSeq |= 0x8000; return $clockSeq; } /** * Applies the RFC 4122 version number to the 16-bit `time_hi_and_version` field * * @link http://tools.ietf.org/html/rfc4122#section-4.1.3 RFC 4122, § 4.1.3: Version * * @param int $timeHi The value of the 16-bit `time_hi_and_version` field * before the RFC 4122 version is applied * @param int $version The RFC 4122 version to apply to the `time_hi` field * * @return int The 16-bit time_hi field of the timestamp multiplexed with * the UUID version number * * @psalm-pure */ public static function applyVersion(int $timeHi, int $version): int { $timeHi = $timeHi & 0x0fff; $timeHi |= $version << 12; return $timeHi; } } PK ��$Z�ja* * / uuid/src/Converter/NumberConverterInterface.phpnu �[��� <?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\Converter; /** * A number converter converts UUIDs from hexadecimal characters into * representations of integers and vice versa * * @psalm-immutable */ interface NumberConverterInterface { /** * Converts a hexadecimal number into an string integer representation of * the number * * The integer representation returned is a string representation of the * integer, to accommodate unsigned integers greater than PHP_INT_MAX. * * @param string $hex The hexadecimal string representation to convert * * @return string String representation of an integer * * @psalm-return numeric-string * * @psalm-pure */ public function fromHex(string $hex): string; /** * Converts a string integer representation into a hexadecimal string * representation of the number * * @param string $number A string integer representation to convert; this * must be a numeric string to accommodate unsigned integers greater * than PHP_INT_MAX. * * @return string Hexadecimal string * * @psalm-return non-empty-string * * @psalm-pure */ public function toHex(string $number): string; } PK ��$Zm�E�7 7 , uuid/src/Converter/Time/PhpTimeConverter.phpnu �[��� <?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\Converter\Time; use Ramsey\Uuid\Converter\TimeConverterInterface; use Ramsey\Uuid\Math\BrickMathCalculator; use Ramsey\Uuid\Math\CalculatorInterface; use Ramsey\Uuid\Type\Hexadecimal; use Ramsey\Uuid\Type\Integer as IntegerObject; use Ramsey\Uuid\Type\Time; use function count; use function dechex; use function explode; use function is_float; use function is_int; use function str_pad; use function strlen; use function substr; use const STR_PAD_LEFT; use const STR_PAD_RIGHT; /** * PhpTimeConverter uses built-in PHP functions and standard math operations * available to the PHP programming language to provide facilities for * converting parts of time into representations that may be used in UUIDs * * @psalm-immutable */ class PhpTimeConverter implements TimeConverterInterface { /** * The number of 100-nanosecond intervals from the Gregorian calendar epoch * to the Unix epoch. */ private const GREGORIAN_TO_UNIX_INTERVALS = 0x01b21dd213814000; /** * The number of 100-nanosecond intervals in one second. */ private const SECOND_INTERVALS = 10000000; /** * The number of 100-nanosecond intervals in one microsecond. */ private const MICROSECOND_INTERVALS = 10; /** * @var CalculatorInterface */ private $calculator; /** * @var TimeConverterInterface */ private $fallbackConverter; /** * @var int */ private $phpPrecision; public function __construct( ?CalculatorInterface $calculator = null, ?TimeConverterInterface $fallbackConverter = null ) { if ($calculator === null) { $calculator = new BrickMathCalculator(); } if ($fallbackConverter === null) { $fallbackConverter = new GenericTimeConverter($calculator); } $this->calculator = $calculator; $this->fallbackConverter = $fallbackConverter; $this->phpPrecision = (int) ini_get('precision'); } public function calculateTime(string $seconds, string $microseconds): Hexadecimal { $seconds = new IntegerObject($seconds); $microseconds = new IntegerObject($microseconds); // Calculate the count of 100-nanosecond intervals since the Gregorian // calendar epoch for the given seconds and microseconds. $uuidTime = ((int) $seconds->toString() * self::SECOND_INTERVALS) + ((int) $microseconds->toString() * self::MICROSECOND_INTERVALS) + self::GREGORIAN_TO_UNIX_INTERVALS; // Check to see whether we've overflowed the max/min integer size. // If so, we will default to a different time converter. /** @psalm-suppress RedundantCondition */ if (!is_int($uuidTime)) { return $this->fallbackConverter->calculateTime( $seconds->toString(), $microseconds->toString() ); } return new Hexadecimal(str_pad(dechex((int) $uuidTime), 16, '0', STR_PAD_LEFT)); } public function convertTime(Hexadecimal $uuidTimestamp): Time { $timestamp = $this->calculator->toInteger($uuidTimestamp); // Convert the 100-nanosecond intervals into seconds and microseconds. $splitTime = $this->splitTime( ((int) $timestamp->toString() - self::GREGORIAN_TO_UNIX_INTERVALS) / self::SECOND_INTERVALS ); if (count($splitTime) === 0) { return $this->fallbackConverter->convertTime($uuidTimestamp); } return new Time($splitTime['sec'], $splitTime['usec']); } /** * @param int|float $time The time to split into seconds and microseconds * * @return string[] */ private function splitTime($time): array { $split = explode('.', (string) $time, 2); // If the $time value is a float but $split only has 1 element, then the // float math was rounded up to the next second, so we want to return // an empty array to allow use of the fallback converter. if (is_float($time) && count($split) === 1) { return []; } if (count($split) === 1) { return [ 'sec' => $split[0], 'usec' => '0', ]; } // If the microseconds are less than six characters AND the length of // the number is greater than or equal to the PHP precision, then it's // possible that we lost some precision for the microseconds. Return an // empty array, so that we can choose to use the fallback converter. if (strlen($split[1]) < 6 && strlen((string) $time) >= $this->phpPrecision) { return []; } $microseconds = $split[1]; // Ensure the microseconds are no longer than 6 digits. If they are, // truncate the number to the first 6 digits and round up, if needed. if (strlen($microseconds) > 6) { $roundingDigit = (int) substr($microseconds, 6, 1); $microseconds = (int) substr($microseconds, 0, 6); if ($roundingDigit >= 5) { $microseconds++; } } return [ 'sec' => $split[0], 'usec' => str_pad((string) $microseconds, 6, '0', STR_PAD_RIGHT), ]; } } PK ��$ZYkB�� � 0 uuid/src/Converter/Time/GenericTimeConverter.phpnu �[��� <?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\Converter\Time; use Ramsey\Uuid\Converter\TimeConverterInterface; use Ramsey\Uuid\Math\CalculatorInterface; use Ramsey\Uuid\Math\RoundingMode; use Ramsey\Uuid\Type\Hexadecimal; use Ramsey\Uuid\Type\Integer as IntegerObject; use Ramsey\Uuid\Type\Time; use function explode; use function str_pad; use const STR_PAD_LEFT; /** * GenericTimeConverter uses the provided calculator to calculate and convert * time values * * @psalm-immutable */ class GenericTimeConverter implements TimeConverterInterface { /** * The number of 100-nanosecond intervals from the Gregorian calendar epoch * to the Unix epoch. */ private const GREGORIAN_TO_UNIX_INTERVALS = '122192928000000000'; /** * The number of 100-nanosecond intervals in one second. */ private const SECOND_INTERVALS = '10000000'; /** * The number of 100-nanosecond intervals in one microsecond. */ private const MICROSECOND_INTERVALS = '10'; /** * @var CalculatorInterface */ private $calculator; public function __construct(CalculatorInterface $calculator) { $this->calculator = $calculator; } public function calculateTime(string $seconds, string $microseconds): Hexadecimal { $timestamp = new Time($seconds, $microseconds); // Convert the seconds into a count of 100-nanosecond intervals. $sec = $this->calculator->multiply( $timestamp->getSeconds(), new IntegerObject(self::SECOND_INTERVALS) ); // Convert the microseconds into a count of 100-nanosecond intervals. $usec = $this->calculator->multiply( $timestamp->getMicroseconds(), new IntegerObject(self::MICROSECOND_INTERVALS) ); // Combine the seconds and microseconds intervals and add the count of // 100-nanosecond intervals from the Gregorian calendar epoch to the // Unix epoch. This gives us the correct count of 100-nanosecond // intervals since the Gregorian calendar epoch for the given seconds // and microseconds. /** @var IntegerObject $uuidTime */ $uuidTime = $this->calculator->add( $sec, $usec, new IntegerObject(self::GREGORIAN_TO_UNIX_INTERVALS) ); $uuidTimeHex = str_pad( $this->calculator->toHexadecimal($uuidTime)->toString(), 16, '0', STR_PAD_LEFT ); return new Hexadecimal($uuidTimeHex); } public function convertTime(Hexadecimal $uuidTimestamp): Time { // From the total, subtract the number of 100-nanosecond intervals from // the Gregorian calendar epoch to the Unix epoch. This gives us the // number of 100-nanosecond intervals from the Unix epoch, which also // includes the microtime. $epochNanoseconds = $this->calculator->subtract( $this->calculator->toInteger($uuidTimestamp), new IntegerObject(self::GREGORIAN_TO_UNIX_INTERVALS) ); // Convert the 100-nanosecond intervals into seconds and microseconds. $unixTimestamp = $this->calculator->divide( RoundingMode::HALF_UP, 6, $epochNanoseconds, new IntegerObject(self::SECOND_INTERVALS) ); $split = explode('.', (string) $unixTimestamp, 2); return new Time($split[0], $split[1] ?? 0); } } PK ��$ZA���H H 2 uuid/src/Converter/Time/BigNumberTimeConverter.phpnu �[��� <?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\Converter\Time; use Ramsey\Uuid\Converter\TimeConverterInterface; use Ramsey\Uuid\Math\BrickMathCalculator; use Ramsey\Uuid\Type\Hexadecimal; use Ramsey\Uuid\Type\Time; /** * Previously used to integrate moontoast/math as a bignum arithmetic library, * BigNumberTimeConverter is deprecated in favor of GenericTimeConverter * * @deprecated Transition to {@see GenericTimeConverter}. * * @psalm-immutable */ class BigNumberTimeConverter implements TimeConverterInterface { /** * @var TimeConverterInterface */ private $converter; public function __construct() { $this->converter = new GenericTimeConverter(new BrickMathCalculator()); } public function calculateTime(string $seconds, string $microseconds): Hexadecimal { return $this->converter->calculateTime($seconds, $microseconds); } public function convertTime(Hexadecimal $uuidTimestamp): Time { return $this->converter->convertTime($uuidTimestamp); } } PK ��$Zs�(�g g 1 uuid/src/Converter/Time/DegradedTimeConverter.phpnu �[��� <?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\Converter\Time; /** * @deprecated DegradedTimeConverter is no longer necessary for converting * time on 32-bit systems. Transition to {@see GenericTimeConverter}. * * @psalm-immutable */ class DegradedTimeConverter extends BigNumberTimeConverter { } PK ��$Z�ix - uuid/src/Converter/TimeConverterInterface.phpnu �[��� <?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\Converter; use Ramsey\Uuid\Type\Hexadecimal; use Ramsey\Uuid\Type\Time; /** * 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 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} * * @psalm-pure */ public function convertTime(Hexadecimal $uuidTimestamp): Time; } PK ��$Zbk6�" " 0 uuid/src/Converter/Number/BigNumberConverter.phpnu �[��� <?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\Converter\Number; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Math\BrickMathCalculator; /** * Previously used to integrate moontoast/math as a bignum arithmetic library, * BigNumberConverter is deprecated in favor of GenericNumberConverter * * @deprecated Transition to {@see GenericNumberConverter}. * * @psalm-immutable */ class BigNumberConverter implements NumberConverterInterface { /** * @var NumberConverterInterface */ private $converter; public function __construct() { $this->converter = new GenericNumberConverter(new BrickMathCalculator()); } /** * @inheritDoc * @psalm-pure */ public function fromHex(string $hex): string { return $this->converter->fromHex($hex); } /** * @inheritDoc * @psalm-pure */ public function toHex(string $number): string { return $this->converter->toHex($number); } } PK ��$Z�vW�n n 5 uuid/src/Converter/Number/DegradedNumberConverter.phpnu �[��� <?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\Converter\Number; /** * @deprecated DegradedNumberConverter is no longer necessary for converting * numbers on 32-bit systems. Transition to {@see GenericNumberConverter}. * * @psalm-immutable */ class DegradedNumberConverter extends BigNumberConverter { } PK ��$Z��h� � 4 uuid/src/Converter/Number/GenericNumberConverter.phpnu �[��� <?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\Converter\Number; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Math\CalculatorInterface; use Ramsey\Uuid\Type\Integer as IntegerObject; /** * GenericNumberConverter uses the provided calculate to convert decimal * numbers to and from hexadecimal values * * @psalm-immutable */ class GenericNumberConverter implements NumberConverterInterface { /** * @var CalculatorInterface */ private $calculator; public function __construct(CalculatorInterface $calculator) { $this->calculator = $calculator; } /** * @inheritDoc * @psalm-pure * @psalm-return numeric-string * @psalm-suppress MoreSpecificReturnType we know that the retrieved `string` is never empty * @psalm-suppress LessSpecificReturnStatement we know that the retrieved `string` is never empty */ public function fromHex(string $hex): string { return $this->calculator->fromBase($hex, 16)->toString(); } /** * @inheritDoc * @psalm-pure * @psalm-return non-empty-string * @psalm-suppress MoreSpecificReturnType we know that the retrieved `string` is never empty * @psalm-suppress LessSpecificReturnStatement we know that the retrieved `string` is never empty */ public function toHex(string $number): string { return $this->calculator->toBase(new IntegerObject($number), 16); } } PK ��$Z.�� ) uuid/src/Builder/UuidBuilderInterface.phpnu �[��� <?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\Builder; use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\UuidInterface; /** * A UUID builder builds instances of UuidInterface * * @psalm-immutable */ interface UuidBuilderInterface { /** * Builds and returns a UuidInterface * * @param CodecInterface $codec The codec to use for building this UuidInterface instance * @param string $bytes The byte string from which to construct a UUID * * @return UuidInterface Implementations may choose to return more specific * instances of UUIDs that implement UuidInterface * * @psalm-pure */ public function build(CodecInterface $codec, string $bytes): UuidInterface; } PK ��$ZÚldX X '