Refactor Str::pool method.
This commit is contained in:
parent
c50246c694
commit
5755fdaba0
|
@ -88,17 +88,13 @@ public static function random($length = 16, $type = 'alnum')
|
|||
*/
|
||||
private static function pool($type = 'alnum')
|
||||
{
|
||||
if ($type == 'alnum')
|
||||
switch ($type)
|
||||
{
|
||||
return '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
}
|
||||
elseif ($type == 'alpha')
|
||||
{
|
||||
return 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \Exception("Unrecognized random pool [$type].");
|
||||
case 'alnum':
|
||||
return '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
|
||||
default:
|
||||
return 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue