Browse Source

Refactor Str::pool method.

Taylor Otwell 13 years ago
parent
commit
5755fdaba0
1 changed files with 6 additions and 10 deletions
  1. 6 10
      system/str.php

+ 6 - 10
system/str.php

@@ -88,17 +88,13 @@ class Str {
      */
     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';
         }
     }