| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public static function random($length = 16) |
||
| 24 | { |
||
| 25 | $string = ''; |
||
| 26 | |||
| 27 | while (($len = strlen($string)) < $length) { |
||
| 28 | $size = $length - $len; |
||
| 29 | |||
| 30 | $bytes = random_bytes($size); |
||
| 31 | |||
| 32 | $string .= substr(str_replace(['/', '+', '='], '', base64_encode($bytes)), 0, $size); |
||
| 33 | } |
||
| 34 | |||
| 35 | return $string; |
||
| 36 | } |
||
| 53 |