Fake   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A generate() 0 10 2
1
<?php
2
3
namespace OpCacheGUITest\Mocks\Security\Generator;
4
5
use OpCacheGUI\Security\Generator as SecurityGenerator;
6
7
class Fake implements SecurityGenerator
8
{
9
    /**
10
     * Generates a random string
11
     *
12
     * @param int $length The length of the random string to be generated
13
     */
14
    public function generate($length)
15
    {
16
        $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
17
        $randomString = '';
18
        for ($i = 0; $i < $length; $i++) {
19
            $randomString .= $characters[rand(0, strlen($characters) - 1)];
20
        }
21
22
        return $randomString;
23
    }
24
}
25