Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 /**
  * @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);
     }
 }
Esempio n. 3
0
 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);
     }
 }