Utils   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 3
Bugs 1 Features 2
Metric Value
wmc 4
c 3
b 1
f 2
lcom 0
cbo 0
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A hexDump() 0 15 3
A generateGuid() 0 4 1
1
<?php
2
3
namespace Xls;
4
5
class Utils
6
{
7
    /**
8
     * returns hex representation of binary data
9
     * @param $data
10
     *
11
     * @return string
12
     */
13
    public static function hexDump($data)
14
    {
15
        $result = '';
16
17
        $charCount = strlen($data);
18
        for ($i = 0; $i < $charCount; $i++) {
19
            $byte = ord($data[$i]);
20
            if ($i > 0) {
21
                $result .= ' ';
22
            }
23
            $result .= sprintf('%02X', $byte);
24
        }
25
26
        return $result;
27
    }
28
29
    /**
30
     * @return string
31
     */
32
    public static function generateGuid()
33
    {
34
        return strtoupper(md5(uniqid(rand(), true)));
35
    }
36
}
37