Refactor Str::pool method.

This commit is contained in:
Taylor Otwell 2011-07-07 07:16:20 -07:00
parent c50246c694
commit 5755fdaba0
1 changed files with 6 additions and 10 deletions

View File

@ -88,18 +88,14 @@ public static function random($length = 16, $type = 'alnum')
*/
private static function pool($type = 'alnum')
{
if ($type == 'alnum')
switch ($type)
{
case 'alnum':
return '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
}
elseif ($type == 'alpha')
{
default:
return 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
}
else
{
throw new \Exception("Unrecognized random pool [$type].");
}
}
}