← All changes
|
includes/sdk/google/ramsey/uuid/src/Rfc4122/FieldsInterface.php
+45
-41
1.2.7
→
1.4.2
View file →
| @@ -9,105 +9,109 @@ | ||
| 9 | 9 | * @copyright Copyright (c) Ben Ramsey <[email protected]> |
| 10 | 10 | * @license http://opensource.org/licenses/MIT MIT |
| 11 | 11 | */ |
| 12 | 12 | declare (strict_types=1); |
| 13 | -namespace Dudlewebs\WPMCS\Ramsey\Uuid\Rfc4122; | |
| 13 | +namespace Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Rfc4122; | |
| 14 | 14 | |
| 15 | -use Dudlewebs\WPMCS\Ramsey\Uuid\Fields\FieldsInterface as BaseFieldsInterface; | |
| 16 | -use Dudlewebs\WPMCS\Ramsey\Uuid\Type\Hexadecimal; | |
| 15 | +use Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Fields\FieldsInterface as BaseFieldsInterface; | |
| 16 | +use Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Type\Hexadecimal; | |
| 17 | 17 | /** |
| 18 | - * RFC 4122 defines fields for a specific variant of UUID | |
| 18 | + * UUID fields, as defined by RFC 4122 | |
| 19 | 19 | * |
| 20 | + * This interface defines the fields of an RFC 4122 variant UUID. Since RFC 9562 removed the concept of fields and | |
| 21 | + * instead defined layouts that are specific to a given version, this interface is a legacy artifact of the earlier, and | |
| 22 | + * now obsolete, RFC 4122. | |
| 23 | + * | |
| 20 | 24 | * The fields of an RFC 4122 variant UUID are: |
| 21 | 25 | * |
| 22 | 26 | * * **time_low**: The low field of the timestamp, an unsigned 32-bit integer |
| 23 | 27 | * * **time_mid**: The middle field of the timestamp, an unsigned 16-bit integer |
| 24 | - * * **time_hi_and_version**: The high field of the timestamp multiplexed with | |
| 25 | - * the version number, an unsigned 16-bit integer | |
| 26 | - * * **clock_seq_hi_and_reserved**: The high field of the clock sequence | |
| 27 | - * multiplexed with the variant, an unsigned 8-bit integer | |
| 28 | - * * **clock_seq_low**: The low field of the clock sequence, an unsigned | |
| 29 | - * 8-bit integer | |
| 30 | - * * **node**: The spatially unique node identifier, an unsigned 48-bit | |
| 31 | - * integer | |
| 28 | + * * **time_hi_and_version**: The high field of the timestamp multiplexed with the version number, an unsigned 16-bit integer | |
| 29 | + * * **clock_seq_hi_and_reserved**: The high field of the clock sequence multiplexed with the variant, an unsigned 8-bit integer | |
| 30 | + * * **clock_seq_low**: The low field of the clock sequence, an unsigned 8-bit integer | |
| 31 | + * * **node**: The spatially unique node identifier, an unsigned 48-bit integer | |
| 32 | 32 | * |
| 33 | - * @link http://tools.ietf.org/html/rfc4122#section-4.1 RFC 4122, § 4.1: Format | |
| 33 | + * @link https://www.rfc-editor.org/rfc/rfc4122#section-4.1 RFC 4122, 4.1. Format | |
| 34 | + * @link https://www.rfc-editor.org/rfc/rfc9562#section-4 RFC 9562, 4. UUID Format | |
| 34 | 35 | * |
| 35 | - * @psalm-immutable | |
| 36 | + * @immutable | |
| 36 | 37 | */ |
| 37 | 38 | interface FieldsInterface extends BaseFieldsInterface |
| 38 | 39 | { |
| 39 | 40 | /** |
| 40 | - * Returns the full 16-bit clock sequence, with the variant bits (two most | |
| 41 | - * significant bits) masked out | |
| 41 | + * Returns the full 16-bit clock sequence, with the variant bits (two most significant bits) masked out | |
| 42 | 42 | */ |
| 43 | - public function getClockSeq(): Hexadecimal; | |
| 43 | + public function getClockSeq() : Hexadecimal; | |
| 44 | 44 | /** |
| 45 | 45 | * Returns the high field of the clock sequence multiplexed with the variant |
| 46 | 46 | */ |
| 47 | - public function getClockSeqHiAndReserved(): Hexadecimal; | |
| 47 | + public function getClockSeqHiAndReserved() : Hexadecimal; | |
| 48 | 48 | /** |
| 49 | 49 | * Returns the low field of the clock sequence |
| 50 | 50 | */ |
| 51 | - public function getClockSeqLow(): Hexadecimal; | |
| 51 | + public function getClockSeqLow() : Hexadecimal; | |
| 52 | 52 | /** |
| 53 | 53 | * Returns the node field |
| 54 | 54 | */ |
| 55 | - public function getNode(): Hexadecimal; | |
| 55 | + public function getNode() : Hexadecimal; | |
| 56 | 56 | /** |
| 57 | 57 | * Returns the high field of the timestamp multiplexed with the version |
| 58 | 58 | */ |
| 59 | - public function getTimeHiAndVersion(): Hexadecimal; | |
| 59 | + public function getTimeHiAndVersion() : Hexadecimal; | |
| 60 | 60 | /** |
| 61 | 61 | * Returns the low field of the timestamp |
| 62 | 62 | */ |
| 63 | - public function getTimeLow(): Hexadecimal; | |
| 63 | + public function getTimeLow() : Hexadecimal; | |
| 64 | 64 | /** |
| 65 | 65 | * Returns the middle field of the timestamp |
| 66 | 66 | */ |
| 67 | - public function getTimeMid(): Hexadecimal; | |
| 67 | + public function getTimeMid() : Hexadecimal; | |
| 68 | 68 | /** |
| 69 | 69 | * Returns the full 60-bit timestamp, without the version |
| 70 | 70 | */ |
| 71 | - public function getTimestamp(): Hexadecimal; | |
| 71 | + public function getTimestamp() : Hexadecimal; | |
| 72 | 72 | /** |
| 73 | 73 | * Returns the variant |
| 74 | 74 | * |
| 75 | - * The variant number describes the layout of the UUID. The variant | |
| 76 | - * number has the following meaning: | |
| 75 | + * The variant number describes the layout of the UUID. The variant number has the following meaning: | |
| 77 | 76 | * |
| 78 | 77 | * - 0 - Reserved for NCS backward compatibility |
| 79 | - * - 2 - The RFC 4122 variant | |
| 78 | + * - 2 - The RFC 9562 (formerly RFC 4122) variant | |
| 80 | 79 | * - 6 - Reserved, Microsoft Corporation backward compatibility |
| 81 | 80 | * - 7 - Reserved for future definition |
| 82 | 81 | * |
| 83 | - * For RFC 4122 variant UUIDs, this value should always be the integer `2`. | |
| 82 | + * For RFC 9562 (formerly RFC 4122) variant UUIDs, this value should always be the integer `2`. | |
| 84 | 83 | * |
| 85 | - * @link http://tools.ietf.org/html/rfc4122#section-4.1.1 RFC 4122, § 4.1.1: Variant | |
| 84 | + * @link https://www.rfc-editor.org/rfc/rfc9562#section-4.1 RFC 9562, 4.1. Variant Field | |
| 86 | 85 | */ |
| 87 | - public function getVariant(): int; | |
| 86 | + public function getVariant() : int; | |
| 88 | 87 | /** |
| 89 | - * Returns the version | |
| 88 | + * Returns the UUID version | |
| 90 | 89 | * |
| 91 | - * The version number describes how the UUID was generated and has the | |
| 92 | - * following meaning: | |
| 90 | + * The version number describes how the UUID was generated and has the following meaning: | |
| 93 | 91 | * |
| 94 | - * 1. Time-based UUID | |
| 92 | + * 1. Gregorian time UUID | |
| 95 | 93 | * 2. DCE security UUID |
| 96 | 94 | * 3. Name-based UUID hashed with MD5 |
| 97 | 95 | * 4. Randomly generated UUID |
| 98 | 96 | * 5. Name-based UUID hashed with SHA-1 |
| 97 | + * 6. Reordered Gregorian time UUID | |
| 98 | + * 7. Unix Epoch time UUID | |
| 99 | + * 8. Custom format UUID | |
| 99 | 100 | * |
| 100 | - * This returns `null` if the UUID is not an RFC 4122 variant, since version | |
| 101 | - * is only meaningful for this variant. | |
| 101 | + * This returns `null` if the UUID is not an RFC 9562 (formerly RFC 4122) variant, since the version is only | |
| 102 | + * meaningful for this variant. | |
| 102 | 103 | * |
| 103 | - * @link http://tools.ietf.org/html/rfc4122#section-4.1.3 RFC 4122, § 4.1.3: Version | |
| 104 | + * @link https://www.rfc-editor.org/rfc/rfc9562#section-4.2 RFC 9562, 4.2. Version Field | |
| 105 | + * | |
| 106 | + * @pure | |
| 104 | 107 | */ |
| 105 | - public function getVersion(): ?int; | |
| 108 | + public function getVersion() : ?int; | |
| 106 | 109 | /** |
| 107 | 110 | * Returns true if these fields represent a nil UUID |
| 108 | 111 | * |
| 109 | - * The nil UUID is special form of UUID that is specified to have all 128 | |
| 110 | - * bits set to zero. | |
| 112 | + * The nil UUID is a special form of UUID that is specified to have all 128 bits set to zero. | |
| 113 | + * | |
| 114 | + * @pure | |
| 111 | 115 | */ |
| 112 | - public function isNil(): bool; | |
| 116 | + public function isNil() : bool; | |
| 113 | 117 | } |