| @@ 1004-1017 (lines=14) @@ | ||
| 1001 | * |
|
| 1002 | * @return string |
|
| 1003 | */ |
|
| 1004 | protected function token(int $length = 15): string { |
|
| 1005 | $chars = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890'; |
|
| 1006 | ||
| 1007 | $str = ''; |
|
| 1008 | $max = strlen($chars); |
|
| 1009 | for ($i = 0; $i < $length; $i++) { |
|
| 1010 | try { |
|
| 1011 | $str .= $chars[random_int(0, $max - 1)]; |
|
| 1012 | } catch (Exception $e) { |
|
| 1013 | } |
|
| 1014 | } |
|
| 1015 | ||
| 1016 | return $str; |
|
| 1017 | } |
|
| 1018 | ||
| 1019 | ||
| 1020 | } |
|
| @@ 347-360 (lines=14) @@ | ||
| 344 | * |
|
| 345 | * @return string |
|
| 346 | */ |
|
| 347 | public function token(int $length = 0): string { |
|
| 348 | $chars = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890'; |
|
| 349 | ||
| 350 | $str = ''; |
|
| 351 | $max = strlen($chars) - 1; |
|
| 352 | for ($i = 0; $i <= $length; $i++) { |
|
| 353 | try { |
|
| 354 | $str .= $chars[random_int(0, $max)]; |
|
| 355 | } catch (Exception $e) { |
|
| 356 | } |
|
| 357 | } |
|
| 358 | ||
| 359 | return $str; |
|
| 360 | } |
|
| 361 | ||
| 362 | ||
| 363 | /** |
|