Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
10 | 1 | public function generate($length = 32) |
|
11 | { |
||
12 | 1 | $nonce = ''; |
|
13 | |||
14 | 1 | while (($currentNonceLength = strlen($nonce)) < $length) { |
|
15 | 1 | $size = $length - $currentNonceLength; |
|
16 | 1 | $randomString = $this->base64EncodedRandomBytes($size); |
|
17 | 1 | $nonce .= substr($this->extractAlphaNumericFromBase64EncodedString($randomString), 0, $size); |
|
18 | } |
||
19 | |||
20 | 1 | return $nonce; |
|
21 | } |
||
22 | |||
45 |