1: <?php
2: namespace Worldline\Connect\Sdk\Communication;
3:
4: /**
5: * Class UuidGenerator
6: * Generator class for v4 UUID's
7: *
8: * @package Worldline\Connect\Sdk\Communication
9: */
10: class UuidGenerator
11: {
12: private function __construct()
13: {
14: }
15:
16: /**
17: * @return string
18: */
19: public static function generatedUuid(): string
20: {
21: return sprintf(
22: '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
23: mt_rand(0, 0xffff),
24: mt_rand(0, 0xffff),
25: mt_rand(0, 0xffff),
26: mt_rand(0, 0x0fff) | 0x4000,
27: mt_rand(0, 0x3fff) | 0x8000,
28: mt_rand(0, 0xffff),
29: mt_rand(0, 0xffff),
30: mt_rand(0, 0xffff)
31: );
32: }
33: }
34: