| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | public static function genUUIDv4(): string { |
||
| 12 | // Generate a unique id from a former random-uuid-generator |
||
| 13 | try { |
||
| 14 | return sprintf('ID%04x%04x%04x%04x%04x%04x%04x%04x', |
||
| 15 | random_int(0, 0xffff), |
||
| 16 | random_int(0, 0xffff), |
||
| 17 | random_int(0, 0xffff), |
||
| 18 | random_int(0, 0x0fff) | 0x4000, |
||
| 19 | random_int(0, 0x3fff) | 0x8000, |
||
| 20 | random_int(0, 0xffff), |
||
| 21 | random_int(0, 0xffff), |
||
| 22 | random_int(0, 0xffff) |
||
| 23 | ); |
||
| 24 | } catch (Throwable $e) { |
||
| 25 | // Should not throw an excepion under normal conditions |
||
| 26 | throw new RuntimeException($e->getMessage(), $e->getCode(), $e); |
||
| 27 | } |
||
| 30 |