Quellcode durchsuchen

[GENERIC] Zend_Locale:

- performance increasement on isLocale

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@17330 44c647ce-9c0f-0410-b52a-842ac1e357ba
thomas vor 16 Jahren
Ursprung
Commit
b84e66178d
1 geänderte Dateien mit 8 neuen und 0 gelöschten Zeilen
  1. 8 0
      library/Zend/Locale.php

+ 8 - 0
library/Zend/Locale.php

@@ -748,6 +748,14 @@ class Zend_Locale
      */
      */
     public static function isLocale($locale, $strict = false, $compatible = true)
     public static function isLocale($locale, $strict = false, $compatible = true)
     {
     {
+        if ($locale instanceof Zend_Locale) {
+            return true;
+        }
+
+        if (($locale !== null) and !is_string($locale) and !is_array($locale)) {
+            return false;
+        }
+
         try {
         try {
             $locale = self::_prepareLocale($locale, $strict);
             $locale = self::_prepareLocale($locale, $strict);
         } catch (Zend_Locale_Exception $e) {
         } catch (Zend_Locale_Exception $e) {