### Setup and Run Tests on FreeBSD VM Source: https://github.com/ramsey/uuid/blob/4.x/resources/vagrant/freebsd/README.md This snippet details the process of navigating to the project's FreeBSD Vagrant environment, starting the virtual machine, connecting to it via SSH, installing Composer dependencies, and executing the project's tests. ```bash cd /path/to/uuid/resources/vagrant/freebsd vagrant up vagrant ssh ``` ```bash cd uuid/ composer install composer run-script --timeout=0 test ``` -------------------------------- ### Setup Virtual Environment and Install Dependencies Source: https://github.com/ramsey/uuid/blob/4.x/docs/README.md This snippet outlines the steps to create a virtual environment using virtualenvwrapper, install project requirements, and activate the environment for building documentation. ```bash pip install virtualenvwrapper mkvirtualenv ramsey-uuid-docs cd docs/ workon ramsey-uuid-docs pip install -r requirements.txt ``` -------------------------------- ### Install ramsey/uuid with Composer Source: https://github.com/ramsey/uuid/blob/4.x/docs/quickstart.rst This command adds the ramsey/uuid library to your project's dependencies using Composer, the standard PHP package manager. ```bash composer require ramsey/uuid ``` -------------------------------- ### Local Development Setup Source: https://github.com/ramsey/uuid/blob/4.x/CONTRIBUTING.md Steps to set up the ramsey/uuid project for local development, including installing dependencies. ```bash cd /path/to/repository composer install ``` -------------------------------- ### Setup and Run Tests on Windows VM Source: https://github.com/ramsey/uuid/blob/4.x/resources/vagrant/windows/README.md This snippet details the process of navigating to the Windows test environment, starting the Vagrant virtual machine, connecting via SSH, and executing the project's tests using Composer. ```bash cd /path/to/uuid/resources/vagrant/windows vagrant up vagrant ssh ``` ```shell refreshenv cd uuid composer install composer run-script --timeout=0 test ``` -------------------------------- ### Ramsey/UUID Static Generation Methods Source: https://github.com/ramsey/uuid/blob/4.x/docs/quickstart.rst This table outlines the static methods available in the `Ramsey\Uuid\Uuid` class for generating different versions of UUIDs and performing utility operations. These methods provide a quick way to work with UUIDs without complex configuration. ```APIDOC Uuid::uuid1() - Generates a RFC 4122 version 1 UUID. Uuid::uuid2() - Generates a RFC 4122 version 2 UUID. Uuid::uuid3() - Generates a RFC 4122 version 3 UUID. Uuid::uuid4() - Generates a RFC 4122 version 4 UUID. Uuid::uuid5() - Generates a RFC 4122 version 5 UUID. Uuid::uuid6() - Generates a RFC 4122 version 6 UUID. Uuid::uuid7() - Generates a RFC 4122 version 7 UUID. Uuid::uuid8() - Generates a RFC 4122 version 8 UUID. Uuid::isValid(string $uuid) - Checks whether a string is a valid UUID. - Returns: bool Uuid::fromString(string $uuid) - Creates a UUID instance from a string UUID. - Returns: Ramsey\Uuid\UuidInterface Uuid::fromBytes(string $bytes) - Creates a UUID instance from a 16-byte string. - Returns: Ramsey\Uuid\UuidInterface Uuid::fromInteger(string $integer) - Creates a UUID instance from a string integer. - Returns: Ramsey\Uuid\UuidInterface Uuid::fromDateTime(DateTimeInterface $dateTime) - Creates a version 1 UUID instance from a PHP DateTimeInterface object. - Returns: Ramsey\Uuid\Rfc4122\UuidV1 ``` -------------------------------- ### Build Documentation Source: https://github.com/ramsey/uuid/blob/4.x/docs/README.md This snippet details the process of building the HTML documentation for the ramsey/uuid project after setting up the environment and installing dependencies. ```bash cd docs/ workon ramsey-uuid-docs make html ``` -------------------------------- ### Install ramsey/uuid with Composer Source: https://github.com/ramsey/uuid/blob/4.x/README.md This snippet shows the Composer command to install the ramsey/uuid library and add it as a dependency to your PHP project. ```Bash composer require ramsey/uuid ``` -------------------------------- ### Update Composer Dependencies Source: https://github.com/ramsey/uuid/blob/4.x/docs/faq.rst Instructions to remove the abandoned 'rhumsaa/uuid' package and install the recommended 'ramsey/uuid' package using Composer. ```text Package rhumsaa/uuid is abandoned; you should avoid using it. Use ramsey/uuid instead. ``` ```bash composer remove rhumsaa/uuid composer require ramsey/uuid=^2.9 ``` -------------------------------- ### Example Output of Ordered-time UUID Generation Source: https://github.com/ramsey/uuid/blob/4.x/docs/customize/ordered-time-codec.rst Provides an example of the output generated when using the Ordered-time Codec to create a version 1 UUID. This output includes the UUID string, version, creation date, node information, and the byte representation. ```text UUID: 593200aa-61ae-11ea-bbf2-0242ac130003 Version: 1 Date: Mon, 09 Mar 2020 02:33:23 +0000 Node: 0242ac130003 Bytes: 11ea61ae593200aabbf20242ac130003 ``` -------------------------------- ### Run Tests on Linux Source: https://github.com/ramsey/uuid/blob/4.x/resources/vagrant/linux/README.md Steps to execute tests for the uuid project within a Linux virtual machine managed by Vagrant. This includes setting up the environment, installing dependencies, and running the test suite. ```bash cd /path/to/uuid/resources/vagrant/linux vagrant up vagrant ssh ``` ```bash cd uuid/ composer install composer run-script --timeout=0 test ``` -------------------------------- ### Example Version 1 UUID Output Source: https://github.com/ramsey/uuid/blob/4.x/docs/rfc4122/version1.rst An example output of a generated version 1 UUID, showing its string representation, version, creation date, and the node identifier. ```text UUID: e22e1622-5c14-11ea-b2f3-0242ac130003 Version: 1 Date: Sun, 01 Mar 2020 23:32:15 +0000 Node: 0242ac130003 ``` -------------------------------- ### Generate and Print a UUID v4 Source: https://github.com/ramsey/uuid/blob/4.x/docs/quickstart.rst This PHP code snippet demonstrates how to generate a version 4 UUID using the static `uuid4()` method and then print its string representation and version number. It utilizes the `Ramsey\Uuid\Uuid` class. ```php use Ramsey\Uuid\Uuid; $uuid = Uuid::uuid4(); printf( "UUID: %s\nVersion: %d\n", $uuid->toString(), $uuid->getFields()->getVersion() ); ``` -------------------------------- ### Example Output of Version 4 UUID Generation Source: https://github.com/ramsey/uuid/blob/4.x/docs/rfc4122/version4.rst This shows an example of the output produced when generating a Version 4 UUID using the provided PHP code snippet. ```text UUID: 1ee9aa1b-6510-4105-92b9-7171bb2f3089 Version: 4 ``` -------------------------------- ### Example Version 7 UUID Output Source: https://github.com/ramsey/uuid/blob/4.x/docs/rfc4122/version7.rst This is an example of the output format when generating a Version 7 UUID, showing the UUID string, its version number, and the formatted date and time. ```text UUID: 01833ce0-3486-7bfd-84a1-ad157cf64005 Version: 7 Date: Wed, 14 Sep 2022 16:41:10 +0000 ``` -------------------------------- ### Using brick/math for Node Conversion Source: https://github.com/ramsey/uuid/blob/4.x/docs/upgrading/3-to-4.rst Example demonstrating how to convert a UUID node to a string integer using the brick/math library for arbitrary-precision mathematics. ```php use Brick\Math\BigInteger; // Assuming $uuid is an instance of Ramsey\Uuid\UuidInterface // $node = BigInteger::fromBase($uuid->getFields()->getNode()->toString(), 16); ``` -------------------------------- ### Example ULID Conversion Output Source: https://github.com/ramsey/uuid/blob/4.x/docs/rfc4122/version7.rst This is an example of the output when a Version 7 UUID is successfully converted to a ULID using Crockford's Base32 encoding. ```text ULID: 01GCZ05N3JFRKBRWKNGCQZGP44 ``` -------------------------------- ### Example Output of Version 6 UUID Generation Source: https://github.com/ramsey/uuid/blob/4.x/docs/rfc4122/version6.rst Provides an example of the output format when generating a Version 6 UUID, including the UUID string, version, date, and node. ```text UUID: 1ea60f56-b67b-61fc-829a-0242ac130003 Version: 6 Date: Sun, 08 Mar 2020 04:29:37 +0000 Node: 0242ac130003 ``` -------------------------------- ### Timestamp-first COMB Codec Output Example Source: https://github.com/ramsey/uuid/blob/4.x/docs/customize/timestamp-first-comb-codec.rst This is an example output from using the Timestamp-first COMB codec to generate a version 4 UUID. It shows the generated UUID string, its version, and its byte representation. ```text UUID: 9009ebcc-cd99-4b5f-90cf-9155607d2de9 Version: 4 Bytes: 9009ebcccd994b5f90cf9155607d2de9 ``` -------------------------------- ### Version 8 UUID Output Example (Text) Source: https://github.com/ramsey/uuid/blob/4.x/docs/rfc4122/version8.rst Example output format for a generated Version 8 UUID, showing the UUID string and its version number. ```text UUID: 00112233-4455-8677-8899-aabbccddeeff Version: 8 ``` -------------------------------- ### Guid Class Methods Source: https://github.com/ramsey/uuid/blob/4.x/docs/reference/guid-guid.rst This section documents the methods available within the Guid class. It specifically highlights the `getFields` method, which returns the constituent fields of a GUID. ```APIDOC Ramsey\Uuid\Guid\Guid: getFields(): Ramsey\Uuid\Guid\Fields Returns the fields that comprise this GUID. Parameters: None Returns: Ramsey\Uuid\Guid\Fields: An object containing the fields of the GUID. ``` -------------------------------- ### Run Tests and Coding Standards Source: https://github.com/ramsey/uuid/blob/4.x/CONTRIBUTING.md Execute all tests and coding standards checks for the project. Ensure `composer install` has been run prior to executing this command. CaptainHook will automatically run these checks before a push. ```shell composer test ``` -------------------------------- ### UUID Hexadecimal Format Example Source: https://github.com/ramsey/uuid/blob/4.x/docs/introduction.rst Demonstrates the standard hexadecimal string representation of a UUID, as defined by RFC 9562 (formerly RFC 4122). ```text ebb5c735-0308-4e3c-9aea-8a270aebfe15 ``` -------------------------------- ### Example Output of Version 2 UUID Generation Source: https://github.com/ramsey/uuid/blob/4.x/docs/rfc4122/version2.rst This is an example of the output generated by the `Generate Version 2 DCE Security UUID (Person Domain)` code snippet. It shows the structure and typical values for a Version 2 UUID. ```text UUID: 000001f5-5e9a-21ea-9e00-0242ac130003 Version: 2 Date: Thu, 05 Mar 2020 04:30:10 +0000 Node: 0242ac130003 Domain: person ID: 501 ``` -------------------------------- ### Behavior Difference: Factory vs. Static UUID Generation Source: https://github.com/ramsey/uuid/blob/4.x/docs/customize/factory.rst This example highlights the difference in UUID generation between using a configured factory instance ($factory->uuid1()) and the static Uuid::uuid1() method after the factory has been customized. It prints the UUID string and byte representation for comparison. ```php $orderedTimeUuid = $factory->uuid1(); printf( "UUID: %s\nBytes: %s\n\n", $orderedTimeUuid->toString(), bin2hex($orderedTimeUuid->getBytes()) ); $uuid = Uuid::uuid1(); printf( "UUID: %s\nBytes: %s\n\n", $uuid->toString(), bin2hex($uuid->getBytes()) ); ``` -------------------------------- ### Mocking UuidInterface and DateTime in PHP Source: https://github.com/ramsey/uuid/blob/4.x/docs/testing.rst This example demonstrates how to mock the UuidInterface and DateTime classes using Mockery in PHP. It shows how to set expectations on mocked objects and assert that specific methods are called, which is useful for unit testing. ```php public function testTellTime(): void { $dateTime = Mockery::mock(DateTime::class); $dateTime->expects()->format('Y-m-d H:i:s')->andReturn('a test date'); $uuid = Mockery::mock(UuidInterface::class, [ 'getDateTime' => $dateTime, ]); $myObj = new MyClass(); $this->assertSame('a test date', $myObj->tellTime($uuid)); } ``` -------------------------------- ### Example Version 7 UUID Output from Specific Date Source: https://github.com/ramsey/uuid/blob/4.x/docs/rfc4122/version7.rst This text block shows the expected output when generating a Version 7 UUID from a specific date, demonstrating how the UUID and its associated timestamp reflect the input date. ```text UUID: ffffffff-ffff-7964-a8f6-001336ac20cb Version: 7 Date: Tue, 02 Aug 10889 05:31:50 +0000 ``` -------------------------------- ### Decoding a GUID from byte representation Source: https://github.com/ramsey/uuid/blob/4.x/docs/nonstandard/guid.rst This snippet demonstrates how to decode a GUID from its 16-byte binary representation into a Ramsey\Uuid\Guid\Guid object. It utilizes the UuidFactory with a specific FeatureSet that enables GUID handling. The example shows how to extract the class name, string representation, version, and raw bytes of the decoded GUID. ```php use Ramsey\Uuid\FeatureSet; use Ramsey\Uuid\UuidFactory; // The bytes of a GUID previously stored in some datastore. $guidBytes = hex2bin('0eab93fc9ec9584b975e9c5e68c53624'); $useGuids = true; $featureSet = new FeatureSet($useGuids); $factory = new UuidFactory($featureSet); $guid = $factory->fromBytes($guidBytes); printf( "Class: %s\nGUID: %s\nVersion: %d\nBytes: %s\n", get_class($guid), $guid->toString(), $guid->getFields()->getVersion(), bin2hex($guid->getBytes()) ); ``` -------------------------------- ### GUID Byte Representation Example Source: https://github.com/ramsey/uuid/blob/4.x/docs/nonstandard/guid.rst Illustrates the byte order of a GUID as stored in a 16-byte binary string. This representation is crucial for understanding the difference between GUIDs and standard UUIDs, particularly when dealing with data stored in systems like Microsoft SQL Server. ```text 0e ab 93 fc 9e c9 58 4b 97 5e 9c 5e 68 c5 36 24 ``` -------------------------------- ### Convert a GUID to a UUID Source: https://github.com/ramsey/uuid/blob/4.x/docs/nonstandard/guid.rst This example shows how to convert a GUID object's string representation into a standard RFC 4122 UUID object. It highlights that while the string representation remains the same, the underlying byte order differs between GUIDs (little-endian for the first 64 bits) and UUIDs (big-endian). The output displays the class, UUID string, version, and bytes of the resulting UUID. ```php $uuid = Uuid::fromString($guid->toString()); printf( "Class: %s\nUUID: %s\nVersion: %d\nBytes: %s\n", get_class($uuid), $uuid->toString(), $uuid->getFields()->getVersion(), bin2hex($uuid->getBytes()) ); ``` -------------------------------- ### View Built Documentation Source: https://github.com/ramsey/uuid/blob/4.x/docs/README.md This snippet shows how to open the generated HTML documentation files in a web browser after the build process is complete. ```bash open _build/html/index.html ``` -------------------------------- ### UUID Byte Representation Example Source: https://github.com/ramsey/uuid/blob/4.x/docs/nonstandard/guid.rst Shows the byte order of a standard RFC 4122 UUID when represented as a 16-byte binary string. This is contrasted with the GUID byte representation to highlight the endianness differences, especially in the first 64 bits. ```text fc 93 ab 0e c9 9e 4b 58 97 5e 9c 5e 68 c5 36 24 ``` -------------------------------- ### Running Project Tests Source: https://github.com/ramsey/uuid/blob/4.x/CONTRIBUTING.md Command to execute the project's test suite locally. ```bash composer test ``` -------------------------------- ### Project Dependencies Source: https://github.com/ramsey/uuid/blob/4.x/docs/requirements.txt Lists the Python packages required for the /ramsey/uuid project, including documentation tools. ```python Sphinx==7.3.7 sphinx-rtd-theme==2.0.0 sphinxcontrib-phpdomain==0.11.1 ``` -------------------------------- ### Guid\Fields Class Source: https://github.com/ramsey/uuid/blob/4.x/docs/reference/guid-fields.rst Represents the fields of a GUID and implements the Rfc4122\FieldsInterface. This class provides methods to access and manipulate the various components of a UUID. ```php namespace Ramsey\Uuid\Guid; use Ramsey\Uuid\Rfc4122\FieldsInterface; /** * Represents the fields of a GUID. */ class Fields implements FieldsInterface { // Class implementation details would go here } ``` -------------------------------- ### Run tests on Linux Source: https://github.com/ramsey/uuid/blob/4.x/resources/vagrant/README.md Instructions to run tests on a Linux environment using Vagrant. This typically involves navigating to the linux directory and executing a Vagrant command. ```bash cd linux vagrant up vagrant ssh -c "make test" ``` -------------------------------- ### UUID Generation and Creation Methods Source: https://github.com/ramsey/uuid/blob/4.x/docs/reference/uuid.rst Provides static methods for generating and creating UUID instances. Includes methods for UUID v7, v8, and creation from various formats like strings, bytes, integers, and datetimes. Also includes a method for validating UUID strings and setting the UUID factory. ```APIDOC uuid7($dateTime = null) Generates a version 7 UUID. :param DateTimeInterface|null $dateTime: The date from which to create the UUID instance :returns: A version 7 UUID :returntype: Ramsey\Uuid\Rfc4122\UuidV7 uuid8($bytes) Generates a version 8, implementation-specific, custom format UUID. :param string $bytes: A 16-byte octet string. :returns: A version 8 UUID :returntype: Ramsey\Uuid\Rfc4122\UuidV8 fromString($uuid) Creates an instance of UuidInterface from the string standard representation. :param string $uuid: The string standard representation of a UUID :returntype: Ramsey\Uuid\UuidInterface fromBytes($bytes) Creates an instance of UuidInterface from a 16-byte string. :param string $bytes: A 16-byte binary string representation of a UUID :returntype: Ramsey\Uuid\UuidInterface fromInteger($integer) Creates an instance of UuidInterface from a 128-bit string integer. :param string $integer: A 128-bit string integer representation of a UUID :returntype: Ramsey\Uuid\UuidInterface fromDateTime($dateTime[, $node[, $clockSeq]]) Creates a version 1 UUID instance from a `DateTimeInterface` instance. :param DateTimeInterface $dateTime: The date from which to create the UUID instance :param Ramsey\Uuid\Type\Hexadecimal|null $node: An optional hexadecimal node to use :param int|null $clockSeq: An optional clock sequence to use :returns: A version 1 UUID :returntype: Ramsey\Uuid\Rfc4122\UuidV1 isValid($uuid) Validates the string standard representation of a UUID. :param string $uuid: The string standard representation of a UUID :returntype: ``bool`` setFactory($factory) Sets the factory used to create UUIDs. :param Ramsey\Uuid\UuidFactoryInterface $factory: A UUID factory to use for all UUID generation :returntype: void ``` -------------------------------- ### Composer Commands for Development Source: https://github.com/ramsey/uuid/blob/4.x/CONTRIBUTING.md Common Composer commands used for developing and maintaining the ramsey/uuid project, including linting and static analysis. ```bash composer list composer dev:lint composer dev:lint:fix composer dev:analyze ``` -------------------------------- ### Set Alternate Validator for Uuid::isValid() Source: https://github.com/ramsey/uuid/blob/4.x/docs/customize/validators.rst This example demonstrates how to set an alternate validator, specifically the RFC 4122 validator, for the Uuid::isValid() method in the ramsey/uuid library. It shows the necessary imports, factory creation, validator setting, and a basic usage example. ```php use Ramsey\Uuid\Rfc4122\Validator as Rfc4122Validator; use Ramsey\Uuid\Uuid; use Ramsey\Uuid\UuidFactory; $factory = new UuidFactory(); $factory->setValidator(new Rfc4122Validator()); Uuid::setFactory($factory); if (!Uuid::isValid('2bfb5006-087b-9553-5082-e8f39337ad29')) { echo "This UUID is not valid!\n"; } ``` -------------------------------- ### UuidFactoryInterface API Documentation Source: https://github.com/ramsey/uuid/blob/4.x/docs/reference/uuidfactoryinterface.rst This section provides comprehensive API documentation for the UuidFactoryInterface, detailing its methods for generating and creating UUIDs. It covers method signatures, parameters, return types, and descriptions for each UUID version and creation method. ```APIDOC UuidFactoryInterface: Represents a UUID factory. getValidator(): Ramsey\Uuid\Validator\ValidatorInterface Returns the UUID validator instance. uuid1([$node[, $clockSeq]]): Ramsey\Uuid\Rfc4122\UuidV1 Generates a version 1, Gregorian time UUID. Parameters: $node: An optional hexadecimal node to use. $clockSeq: An optional clock sequence to use. uuid2($localDomain[, $localIdentifier[, $node[, $clockSeq]]]): Ramsey\Uuid\Rfc4122\UuidV2 Generates a version 2, DCE Security UUID. Parameters: $localDomain: The local domain to use (e.g., Uuid::DCE_DOMAIN_PERSON). $localIdentifier: A local identifier for the domain. $node: An optional hexadecimal node to use. $clockSeq: An optional clock sequence to use. uuid3($ns, $name): Ramsey\Uuid\Rfc4122\UuidV3 Generates a version 3, name-based (MD5) UUID. Parameters: $ns: The namespace for this identifier. $name: The name from which to generate an identifier. uuid4(): Ramsey\Uuid\Rfc4122\UuidV4 Generates a version 4, random UUID. uuid5($ns, $name): Ramsey\Uuid\Rfc4122\UuidV5 Generates a version 5, name-based (SHA-1) UUID. Parameters: $ns: The namespace for this identifier. $name: The name from which to generate an identifier. uuid6([$node[, $clockSeq]]): Ramsey\Uuid\Rfc4122\UuidV6 Generates a version 6, reordered Gregorian time UUID. Parameters: $node: An optional hexadecimal node to use. $clockSeq: An optional clock sequence to use. fromString(string $uuid): Ramsey\Uuid\UuidInterface Creates an instance of UuidInterface from the string standard representation. Parameters: $uuid: The string standard representation of a UUID. fromBytes(string $bytes): Ramsey\Uuid\UuidInterface Creates an instance of UuidInterface from a 16-byte string. Parameters: $bytes: A 16-byte binary string representation of a UUID. fromInteger(string $integer): Ramsey\Uuid\UuidInterface Creates an instance of UuidInterface from a 128-bit string integer. Parameters: $integer: A 128-bit string integer representation of a UUID. fromDateTime(DateTimeInterface $dateTime[, $node[, $clockSeq]]): Ramsey\Uuid\Rfc4122\UuidV1 Creates a version 1 UUID instance from a DateTimeInterface instance. Parameters: $dateTime: The date from which to create the UUID instance. $node: An optional hexadecimal node to use. $clockSeq: An optional clock sequence to use. ``` -------------------------------- ### Provider\Time\FixedTimeProvider Constructor Source: https://github.com/ramsey/uuid/blob/4.x/docs/upgrading/3-to-4.rst Explains that the FixedTimeProvider constructor no longer accepts an array but expects Time instances. ```php use Ramsey\Uuid\Provider\Time\FixedTimeProvider; use Ramsey\Uuid\Type\Time; // The constructor for Provider\Time\FixedTimeProvider no longer accepts an array. // It accepts Type\Time instances. // $time = new Time(1234567890, 123); // $provider = new FixedTimeProvider($time); ``` -------------------------------- ### UuidV2 Class Methods Source: https://github.com/ramsey/uuid/blob/4.x/docs/reference/rfc4122-uuidv2.rst Provides methods for interacting with RFC 4122 version 2 UUIDs. Includes functions to get the timestamp, local domain, and local identifier associated with the UUID. ```APIDOC UuidV2: __construct() Implements Ramsey\Uuid\Rfc4122\UuidInterface. getDateTime(): DateTimeInterface Returns a DateTimeInterface instance representing the timestamp associated with the UUID. Caution: Version 2 UUIDs suffer from some loss of timestamp precision. Returns: A date object representing the timestamp associated with the UUID. Returntype: \DateTimeInterface getLocalDomain(): int Returns the local domain identifier for this UUID, which is one of Ramsey\Uuid\Uuid::DCE_DOMAIN_PERSON, Ramsey\Uuid\Uuid::DCE_DOMAIN_GROUP, or Ramsey\Uuid\Uuid::DCE_DOMAIN_ORG. Returns: The local domain identifier. Returntype: int getLocalDomainName(): string Returns a string name associated with the local domain identifier (one of "person," "group," or "org"). Returns: A string name associated with the local domain identifier. Returntype: string getLocalIdentifier(): Ramsey\Uuid\Type\Integer Returns the local identifier used when creating this UUID. Returns: The local identifier used when creating this UUID. Returntype: Ramsey\Uuid\Type\Integer ``` -------------------------------- ### Create Custom Calculator Wrapper Source: https://github.com/ramsey/uuid/blob/4.x/docs/customize/calculators.rst This PHP code demonstrates how to create a custom calculator wrapper that implements the `Ramsey\Uuid\Math\CalculatorInterface`. It shows the constructor and the `add` method, which uses an internal custom calculator to perform addition operations on UUID numbers. ```php namespace MyProject; use Other\OtherCalculator; use Ramsey\Uuid\Math\CalculatorInterface; use Ramsey\Uuid\Type\Integer as IntegerObject; use Ramsey\Uuid\Type\NumberInterface; class MyUuidCalculator implements CalculatorInterface { private $internalCalculator; public function __construct(OtherCalculator $customCalculator) { $this->internalCalculator = $customCalculator; } public function add(NumberInterface $augend, NumberInterface ...$addends): NumberInterface { $value = $augend->toString(); foreach ($addends as $addend) { $value = $this->internalCalculator->plus($value, $addend->toString()); } return new IntegerObject($value); } /* ... Class truncated for brevity ... */ } ```