| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public static function create() |
||
| 16 | { |
||
| 17 | // use COM helper if available |
||
| 18 | if (function_exists('com_create_guid')) { |
||
| 19 | return com_create_guid(); |
||
| 20 | } |
||
| 21 | |||
| 22 | // generate UUID |
||
| 23 | mt_srand((double) microtime() * 10000); // optional for php 4.2.0 and up. |
||
| 24 | $charid = strtoupper(md5(uniqid(rand(), true))); |
||
| 25 | $uuid = join('-', array( |
||
| 26 | substr($charid, 0, 8), |
||
| 27 | substr($charid, 8, 4), |
||
| 28 | substr($charid, 12, 4), |
||
| 29 | substr($charid, 16, 4), |
||
| 30 | substr($charid, 20, 12), |
||
| 31 | )); |
||
| 32 | |||
| 33 | return $uuid; |
||
| 34 | } |
||
| 35 | |||
| 45 |