Unsupported   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

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