Completed
Branch master (e562f1)
by Antony
02:11
created

Utils   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A createGuid() 0 15 2
1
<?php
2
3
namespace AntonyThorpe\SilverShopUnleashed;
4
5
/**
6
 * Utility
7
 */
8
class Utils
9
{
10
    /**
11
     * Create a global unique id
12
     *
13
     * @return string Guid
14
     */
15
    public static function createGuid()
16
    {
17
        if (function_exists('com_create_guid') === true) {
18
            return trim(com_create_guid(), '{}');
19
        }
20
        return strtolower(sprintf(
21
            '%04X%04X-%04X-%04X-%04X-%04X%04X%04X',
22
            mt_rand(0, 65535),
23
            mt_rand(0, 65535),
24
            mt_rand(0, 65535),
25
            mt_rand(16384, 20479),
26
            mt_rand(32768, 49151),
27
            mt_rand(0, 65535),
28
            mt_rand(0, 65535),
29
            mt_rand(0, 65535)
30
        ));
31
    }
32
}
33