From: Chuck Hagenbuch Date: Sun, 25 Apr 2010 18:53:32 +0000 (-0400) Subject: Revert "first pass at automatic setter injection" X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=d06a417bff260d5fa17ddbd64f557bcb157dbaa0;p=horde.git Revert "first pass at automatic setter injection" This reverts commit f92b1b61098f5cfdd4eb786f1fbacdedf5c38824. Going to do this with post-creation filters, instead of baking a specific method into the default Implementation binder. --- diff --git a/framework/Injector/lib/Horde/Injector.php b/framework/Injector/lib/Horde/Injector.php index eefb3ef84..c37bd273d 100644 --- a/framework/Injector/lib/Horde/Injector.php +++ b/framework/Injector/lib/Horde/Injector.php @@ -234,4 +234,5 @@ class Horde_Injector implements Horde_Injector_Scope return $this->_instances[$interface]; } + } diff --git a/framework/Injector/lib/Horde/Injector/Binder/Implementation.php b/framework/Injector/lib/Horde/Injector/Binder/Implementation.php index 2ccb4a3a9..66928a321 100644 --- a/framework/Injector/lib/Horde/Injector/Binder/Implementation.php +++ b/framework/Injector/lib/Horde/Injector/Binder/Implementation.php @@ -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; - } }