Utils::createGuid()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 0
dl 0
loc 12
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
namespace AntonyThorpe\SilverShopUnleashed;
4
5
/**
6
 * Utility
7
 */
8
class Utils
9
{
10
    /**
11
     * Create a global unique id and return it
12
     */
13
    public static function createGuid(): string
14
    {
15
        return strtolower(sprintf(
16
            '%04X%04X-%04X-%04X-%04X-%04X%04X%04X',
17
            mt_rand(0, 65535),
18
            mt_rand(0, 65535),
19
            mt_rand(0, 65535),
20
            mt_rand(16384, 20479),
21
            mt_rand(32768, 49151),
22
            mt_rand(0, 65535),
23
            mt_rand(0, 65535),
24
            mt_rand(0, 65535)
25
        ));
26
    }
27
}
28