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