private function dumpMethods($className, ClassDefinition $definition) { $str = ''; foreach ($definition->getMethodInjections() as $methodInjection) { $parameters = $this->dumpMethodParameters($className, $methodInjection); $str .= sprintf("\n %s(\n %s\n )", $methodInjection->getMethodName(), $parameters); } return $str; }
/** * @param ClassDefinition $definition * @param object $instance * @param ClassDefinition $classDefinition */ private function injectMethodsAndProperties(ClassDefinition $definition, $instance, ClassDefinition $classDefinition) { // Property injections foreach ($classDefinition->getPropertyInjections() as $propertyInjection) { $this->injectProperty($instance, $propertyInjection); } // Method injections foreach ($classDefinition->getMethodInjections() as $methodInjection) { $this->injectMethod($definition, $instance, $methodInjection); } }
private function injectMethodsAndProperties($object, ClassDefinition $classDefinition) { // Property injections foreach ($classDefinition->getPropertyInjections() as $propertyInjection) { $this->injectProperty($object, $propertyInjection); } // Method injections foreach ($classDefinition->getMethodInjections() as $methodInjection) { $methodReflection = new \ReflectionMethod($object, $methodInjection->getMethodName()); $args = $this->parameterResolver->resolveParameters($methodInjection, $methodReflection); $methodReflection->invokeArgs($object, $args); } }