Pull the factory over to the binder.
authorGunnar Wrobel <p@rdus.de>
Tue, 27 Apr 2010 02:53:39 +0000 (04:53 +0200)
committerGunnar Wrobel <wrobel@temple.(none)>
Tue, 27 Apr 2010 05:34:48 +0000 (07:34 +0200)
framework/Cache/lib/Horde/Cache.php
framework/Core/lib/Horde/Core/Binder/Cache.php

index 347166c..ee39a5b 100644 (file)
  */
 class Horde_Cache
 {
-    /**
-     * Attempts to return a concrete Horde_Cache instance based on $driver.
-     *
-     * @param mixed $driver  The type of concrete Horde_Cache subclass to
-     *                       return. If $driver is an array, then we will look
-     *                       in $driver[0]/lib/Cache/ for the subclass
-     *                       implementation named $driver[1].php.
-     * @param array $params  A hash containing any additional configuration
-     *                       or connection parameters a subclass might need.
-     *
-     * @return Horde_Cache  The newly created concrete Horde_Cache instance.
-     * @throws Horde_Exception
-     */
-    static public function factory($driver, $params = array())
-    {
-        if (is_array($driver)) {
-            list($app, $driv_name) = $driver;
-            $driver = basename($driv_name);
-        } else {
-            $driver = basename($driver);
-        }
-
-        if (empty($driver) || $driver == 'none') {
-            return new Horde_Cache_Null($params);
-        }
-
-        $class = (empty($app) ? 'Horde' : $app) . '_Cache_' . ucfirst($driver);
-        if (class_exists($class)) {
-            return new $class($params);
-        }
-
-        throw new Horde_Exception('Class definition of ' . $class . ' not found.');
-    }
-
 }
index 7379fd8..4b38fb0 100644 (file)
@@ -32,7 +32,23 @@ class Horde_Core_Binder_Cache implements Horde_Injector_Binder
 
         $params['logger'] = $injector->getInstance('Horde_Log_Logger');
 
-        return Horde_Cache::factory($driver, $params);
+        if (is_array($driver)) {
+            list($app, $driv_name) = $driver;
+            $driver = basename($driv_name);
+        } else {
+            $driver = basename($driver);
+        }
+
+        if (empty($driver) || $driver == 'none') {
+            return new Horde_Cache_Null($params);
+        }
+
+        $class = (empty($app) ? 'Horde' : $app) . '_Cache_' . ucfirst($driver);
+        if (class_exists($class)) {
+            return new $class($params);
+        }
+
+        throw new Horde_Exception('Class definition of ' . $class . ' not found.');
     }
 
     public function equals(Horde_Injector_Binder $binder)