@@ -88,7 +88,7 @@ class Uuid implements UuidInterface
88
88
* The max UUID is a special form of UUID that is specified to have all 128
89
89
* bits set to one
90
90
*
91
- * @link https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-04 #section-5.4 Max UUID
91
+ * @link https://datatracker.ietf.org/doc/html/draft-ietf-uuidrev-rfc4122bis-00 #section-5.10 Max UUID
92
92
*/
93
93
public const MAX = 'ffffffff-ffff-ffff-ffff-ffffffffffff ' ;
94
94
@@ -173,17 +173,22 @@ class Uuid implements UuidInterface
173
173
/**
174
174
* Version 6 (reordered time) UUID
175
175
*
176
- * @link https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-04 #section-5.1 UUID Version 6
176
+ * @link https://datatracker.ietf.org/doc/html/draft-ietf-uuidrev-rfc4122bis-00 #section-5.6 UUID Version 6
177
177
*/
178
178
public const UUID_TYPE_REORDERED_TIME = 6 ;
179
179
180
180
/**
181
181
* Version 7 (Unix Epoch time) UUID
182
182
*
183
- * @link https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-04 #section-5.2 UUID Version 7
183
+ * @link https://datatracker.ietf.org/doc/html/draft-ietf-uuidrev-rfc4122bis-00 #section-5.7 UUID Version 7
184
184
*/
185
185
public const UUID_TYPE_UNIX_TIME = 7 ;
186
186
187
+ /**
188
+ * @link https://datatracker.ietf.org/doc/html/draft-ietf-uuidrev-rfc4122bis-00#section-5.8 UUID Version 8
189
+ */
190
+ public const UUID_TYPE_CUSTOM = 8 ;
191
+
187
192
/**
188
193
* DCE Security principal domain
189
194
*
@@ -690,4 +695,34 @@ public static function uuid7(?DateTimeInterface $dateTime = null): UuidInterface
690
695
'The provided factory does not support the uuid7() method ' ,
691
696
);
692
697
}
698
+
699
+ /**
700
+ * Returns a version 8 (custom) UUID
701
+ *
702
+ * The bytes provided may contain any value according to your application's
703
+ * needs. Be aware, however, that other applications may not understand the
704
+ * semantics of the value.
705
+ *
706
+ * @param string $bytes A 16-byte octet string. This is an open blob
707
+ * of data that you may fill with 128 bits of information. Be aware,
708
+ * however, bits 48 through 51 will be replaced with the UUID version
709
+ * field, and bits 64 and 65 will be replaced with the UUID variant. You
710
+ * MUST NOT rely on these bits for your application needs.
711
+ *
712
+ * @return UuidInterface A UuidInterface instance that represents a
713
+ * version 8 UUID
714
+ */
715
+ public static function uuid8 (string $ bytes ): UuidInterface
716
+ {
717
+ $ factory = self ::getFactory ();
718
+
719
+ if (method_exists ($ factory , 'uuid8 ' )) {
720
+ /** @var UuidInterface */
721
+ return $ factory ->uuid8 ($ bytes );
722
+ }
723
+
724
+ throw new UnsupportedOperationException (
725
+ 'The provided factory does not support the uuid8() method ' ,
726
+ );
727
+ }
693
728
}
0 commit comments