deprecate singleton
authorChuck Hagenbuch <chuck@horde.org>
Fri, 16 Jan 2009 22:14:47 +0000 (17:14 -0500)
committerChuck Hagenbuch <chuck@horde.org>
Fri, 16 Jan 2009 22:16:34 +0000 (17:16 -0500)
framework/Browser/lib/Horde/Browser.php

index 6d974e9..9896702 100644 (file)
@@ -256,27 +256,12 @@ class Horde_Browser
     protected $_images = array('jpeg', 'gif', 'png', 'pjpeg', 'x-png', 'bmp');
 
     /**
-     * Returns a reference to the global Browser object, only creating it if
-     * it doesn't already exist.
-     *
-     * This method must be invoked as:<code>
-     *   $browser = &Browser::singleton([$userAgent[, $accept]]);</code>
-     *
-     * @param string $userAgent  The browser string to parse.
-     * @param string $accept     The HTTP_ACCEPT settings to use.
-     *
-     * @return Browser  The Browser object.
+     * @deprecated
      */
-    public static function &singleton($userAgent = null, $accept = null)
+    public static function singleton($userAgent = null, $accept = null)
     {
-        static $instances = array();
-
-        $signature = hash('md5', serialize(array($userAgent, $accept)));
-        if (empty($instances[$signature])) {
-            $instances[$signature] = new Horde_Browser($userAgent, $accept);
-        }
-
-        return $instances[$signature];
+        // trigger_error - warning?
+        return new Horde_Browser($userAgent, $accept);
     }
 
     /**