Revert "first pass at automatic setter injection"
authorChuck Hagenbuch <chuck@horde.org>
Sun, 25 Apr 2010 18:53:32 +0000 (14:53 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Sun, 25 Apr 2010 18:53:32 +0000 (14:53 -0400)
This reverts commit f92b1b61098f5cfdd4eb786f1fbacdedf5c38824. Going to do this
with post-creation filters, instead of baking a specific method into the default
Implementation binder.

framework/Injector/lib/Horde/Injector.php
framework/Injector/lib/Horde/Injector/Binder/Implementation.php

index eefb3ef..c37bd27 100644 (file)
@@ -234,4 +234,5 @@ class Horde_Injector implements Horde_Injector_Scope
 
         return $this->_instances[$interface];
     }
+
 }
index 2ccb4a3..66928a3 100644 (file)
@@ -16,9 +16,8 @@ class Horde_Injector_Binder_Implementation implements Horde_Injector_Binder
 
     /**
      * TODO
-     * @var array
      */
-    private $_setters = array();
+    private $_setters;
 
     /**
      * TODO
@@ -63,10 +62,6 @@ class Horde_Injector_Binder_Implementation implements Horde_Injector_Binder
         $reflectionClass = new ReflectionClass($this->_implementation);
         $this->_validateImplementation($reflectionClass);
         $instance = $this->_getInstance($injector, $reflectionClass);
-        $setters = $this->_findSetters($reflectionClass);
-        foreach ($setters as $setter) {
-            $this->bindSetter($setter);
-        }
         $this->_callSetters($injector, $instance);
         return $instance;
     }
@@ -136,25 +131,4 @@ class Horde_Injector_Binder_Implementation implements Horde_Injector_Binder
         }
     }
 
-    /**
-     * Find annotated setters in the class docblock
-     *
-     * @param ReflectionClass $reflectionClass
-     *
-     * @return array
-     */
-    private function _findSetters(ReflectionClass $reflectionClass)
-    {
-        $setters = array();
-        $docBlock = $reflectionClass->getDocComment();
-        if ($docBlock) {
-            if (preg_match_all('/@inject (\w+)/', $docBlock, $matches)) {
-                foreach ($matches[1] as $setter) {
-                    $setters[] = $setter;
-                }
-            }
-        }
-
-        return $setters;
-    }
 }