Remove binder, just use factory
authorChuck Hagenbuch <chuck@horde.org>
Tue, 2 Nov 2010 11:38:44 +0000 (07:38 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Tue, 2 Nov 2010 11:38:44 +0000 (07:38 -0400)
jonah/lib/Application.php
jonah/lib/Injector/Binder/Driver.php [deleted file]
jonah/lib/Injector/Factory/Driver.php

index fb87b4e..bbbf309 100644 (file)
@@ -34,7 +34,7 @@ class Jonah_Application extends Horde_Registry_Application
      */
     protected function _init()
     {
-        $GLOBALS['injector']->addBinder('Jonah_Driver', new Jonah_Injector_Binder_Driver());
+        $GLOBALS['injector']->bindFactory('Jonah_Driver', 'Jonah_Injector_Factory_Driver', 'create');
     }
 
     /**
diff --git a/jonah/lib/Injector/Binder/Driver.php b/jonah/lib/Injector/Binder/Driver.php
deleted file mode 100644 (file)
index 1471528..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * Jonah_Driver binder.
- * 
- * Copyright 2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file LICENSE for license information (BSD). If you did not
- * did not receive this file, see http://cvs.horde.org/co.php/jonah/LICENSE.
- *
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
- * @package Jonah
- */
-class Jonah_Injector_Binder_Driver Implements Horde_Injector_Binder
-{
-    public function create(Horde_Injector $injector)
-    {
-        $driver = Horde_String::ucfirst($GLOBALS['conf']['news']['storage']['driver']);
-        $params = Horde::getDriverConfig(array('news', 'storage'), $driver);
-
-        $factory = new Jonah_Injector_Factory_Driver($injector);
-        return $factory->getDriver($driver, $params);
-    }
-
-    /**
-     */
-    public function equals(Horde_Injector_Binder $binder)
-    {
-        return false;
-    }
-
-}
index 8da0afc..aba88bf 100644 (file)
@@ -46,9 +46,12 @@ class Jonah_Injector_Factory_Driver
      * @return Jonah_Driver
      * @throws Jonah_Exception
      */
-    public function getDriver($driver, $params = array())
+    public function create()
     {
+        $driver = Horde_String::ucfirst($GLOBALS['conf']['news']['storage']['driver']);
         $driver = basename($driver);
+        $params = Horde::getDriverConfig(array('news', 'storage'), $driver);
+
         $sig = md5($driver . serialize($params));
         if (isset($this->_instances[$sig])) {
             return $this->_instances[$sig];
@@ -64,5 +67,4 @@ class Jonah_Injector_Factory_Driver
 
         return $this->_instances[$sig];
     }
-
 }
\ No newline at end of file