| @@ 986-999 (lines=14) @@ | ||
| 983 | * |
|
| 984 | * @return string |
|
| 985 | */ |
|
| 986 | protected function token(int $length = 15): string { |
|
| 987 | $chars = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890'; |
|
| 988 | ||
| 989 | $str = ''; |
|
| 990 | $max = strlen($chars); |
|
| 991 | for ($i = 0; $i < $length; $i++) { |
|
| 992 | try { |
|
| 993 | $str .= $chars[random_int(0, $max - 1)]; |
|
| 994 | } catch (Exception $e) { |
|
| 995 | } |
|
| 996 | } |
|
| 997 | ||
| 998 | return $str; |
|
| 999 | } |
|
| 1000 | ||
| 1001 | ||
| 1002 | } |
|
| @@ 342-355 (lines=14) @@ | ||
| 339 | * |
|
| 340 | * @return string |
|
| 341 | */ |
|
| 342 | public function token(int $length = 0): string { |
|
| 343 | $chars = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890'; |
|
| 344 | ||
| 345 | $str = ''; |
|
| 346 | $max = strlen($chars) - 1; |
|
| 347 | for ($i = 0; $i <= $length; $i++) { |
|
| 348 | try { |
|
| 349 | $str .= $chars[random_int(0, $max)]; |
|
| 350 | } catch (Exception $e) { |
|
| 351 | } |
|
| 352 | } |
|
| 353 | ||
| 354 | return $str; |
|
| 355 | } |
|
| 356 | ||
| 357 | } |
|
| 358 | ||