|
50 | 50 | * ``` |
51 | 51 | * |
52 | 52 | * @see https://datatracker.ietf.org/doc/rfc4122/ |
53 | | - * @test net.xp_framework.unittest.util.UUIDTest |
| 53 | + * @test util.unittest.UUIDTest |
54 | 54 | */ |
55 | 55 | class UUID implements Value { |
56 | | - const FORMAT = '%04x%04x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x'; |
| 56 | + const FORMAT= '%04x%04x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x'; |
57 | 57 |
|
58 | 58 | public static $NS_DNS, $NS_URL, $NS_OID, $NS_X500; |
59 | 59 |
|
@@ -83,7 +83,14 @@ static function __static() { |
83 | 83 | */ |
84 | 84 | public function __construct($arg) { |
85 | 85 | if ($arg instanceof Bytes) { |
86 | | - $this->populate(implode('-', unpack('H8a/H4b/H4c/H4d/H12e', $arg))); |
| 86 | + $r= unpack('Ntime_low/ntime_mid/ntime_hi_and_version/Cclock_seq_hi_and_reserved/Cclock_seq_low/C6node', $arg); |
| 87 | + $this->version= ($r['time_hi_and_version'] >> 12) & 0xF; |
| 88 | + $this->time_low= $r['time_low']; |
| 89 | + $this->time_mid= $r['time_mid']; |
| 90 | + $this->time_hi_and_version= $r['time_hi_and_version']; |
| 91 | + $this->clock_seq_low= $r['clock_seq_low']; |
| 92 | + $this->clock_seq_hi_and_reserved= $r['clock_seq_hi_and_reserved']; |
| 93 | + $this->node= [$r['node1'], $r['node2'], $r['node3'], $r['node4'], $r['node5'], $r['node6']]; |
87 | 94 | } else if (is_array($arg)) { |
88 | 95 | $this->version= $arg[0]; |
89 | 96 | $this->time_low= $arg[1]; |
|
0 commit comments