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')
|
private static function pool($type = 'alnum')
|
||||||
{
|
{
|
||||||
if ($type == 'alnum')
|
switch ($type)
|
||||||
{
|
{
|
||||||
return '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
case 'alnum':
|
||||||
}
|
return '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
elseif ($type == 'alpha')
|
|
||||||
{
|
default:
|
||||||
return 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
return 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new \Exception("Unrecognized random pool [$type].");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue