Hash   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A generateHash() 0 15 2
1
<?php
2
3
/**
4
 * Hash
5
 * @copyright Copyright (c) 2011 - 2014 Aleksandr Torosh (http://wezoom.com.ua)
6
 * @author Aleksandr Torosh <[email protected]>
7
 */
8
namespace Application\Utils;
9
10
class Hash
11
{
12
13
    public static function generateHash($length = 12)
14
    {
15
        $list = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
16
        $len = mb_strlen($list, 'utf-8');
17
18
        $result = '';
19
        for ($i = 1; $i <= $length; $i++) {
20
            $element = rand(0, $len - 1);
21
            $char = $list[$element];
22
            $result .= $char;
23
        }
24
25
        return $result;
26
27
    }
28
29
}
30