2024-03-08 21:09:43 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Services;
|
|
|
|
|
|
|
|
class StringService
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2024-03-12 23:16:36 +01:00
|
|
|
public static function createUUID()
|
2024-03-08 21:09:43 +01:00
|
|
|
{
|
|
|
|
if (function_exists('com_create_guid') === true) {
|
|
|
|
return trim(com_create_guid(), '{}');
|
|
|
|
}
|
|
|
|
|
|
|
|
return sprintf(
|
|
|
|
'%04X%04X-%04X-%04X-%04X-%04X%04X%04X',
|
|
|
|
mt_rand(0, 65535),
|
|
|
|
mt_rand(0, 65535),
|
|
|
|
mt_rand(0, 65535),
|
|
|
|
mt_rand(16384, 20479),
|
|
|
|
mt_rand(32768, 49151),
|
|
|
|
mt_rand(0, 65535),
|
|
|
|
mt_rand(0, 65535),
|
|
|
|
mt_rand(0, 65535)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|