Base   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A sample() 0 13 2
1
<?php
2
3
namespace Gimei;
4
5
class Base
6
{
7
    public static function sample(array $array)
8
    {
9
        $size = count($array);
10
        if ($size === 0) {
11
            return;
12
        }
13
14
        $min = 0;
15
        $max = $size - 1;
16
        $key = mt_rand($min, $max);
17
18
        return $array[$key];
19
    }
20
}
21