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: /** @return string */
17: public static function generatedUuid()
18: {
19: return sprintf(
20: '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
21: mt_rand(0, 0xffff),
22: mt_rand(0, 0xffff),
23: mt_rand(0, 0xffff),
24: mt_rand(0, 0x0fff) | 0x4000,
25: mt_rand(0, 0x3fff) | 0x8000,
26: mt_rand(0, 0xffff),
27: mt_rand(0, 0xffff),
28: mt_rand(0, 0xffff)
29: );
30: }
31: }
32: