1 | <?php |
||
13 | class Base64UID |
||
14 | { |
||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | private static $chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-'; |
||
19 | |||
20 | /** |
||
21 | * @param int $length |
||
22 | * |
||
23 | * @return string |
||
24 | */ |
||
25 | 1 | public static function generate($length = 10) |
|
34 | |||
35 | /** |
||
36 | * Generates cryptographically secure pseudo-random integers. |
||
37 | * |
||
38 | * Follback for PHP < 7.0 |
||
39 | * |
||
40 | * @see http://php.net/manual/en/function.random-int.php#119670 |
||
41 | * |
||
42 | * @throws \Exception |
||
43 | * |
||
44 | * @param int $min |
||
45 | * @param int $max |
||
46 | * |
||
47 | * @return int|null |
||
48 | */ |
||
49 | 1 | private static function random($min, $max) |
|
81 | } |
||
82 |