RandomStringNoncer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 14
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A hash() 0 8 2
1
<?php
2
3
namespace Acquia\Rest;
4
5
/**
6
 * Returns a random string of ASCII characters.
7
 */
8
class RandomStringNoncer extends NoncerAbstract
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13 42
    protected function hash()
14
    {
15 42
        $string = '';
16 42
        for ($i = 0; $i < $this->length; $i++) {
17 42
            $string .= chr(mt_rand(32, 126));
18 42
        }
19 42
        return base64_encode($string);
20
    }
21
}
22