getMethodInjections() public method

public getMethodInjections ( ) : DI\Definition\ObjectDefinition\MethodInjection[]
return DI\Definition\ObjectDefinition\MethodInjection[] Method injections
 private function dumpMethods($className, ObjectDefinition $definition)
 {
     $str = '';
     foreach ($definition->getMethodInjections() as $methodInjection) {
         $parameters = $this->dumpMethodParameters($className, $methodInjection);
         $str .= sprintf(PHP_EOL . "    %s(" . PHP_EOL . "        %s" . PHP_EOL . "    )", $methodInjection->getMethodName(), $parameters);
     }
     return $str;
 }
Example #2
0
 protected function injectMethodsAndProperties($object, ObjectDefinition $objectDefinition)
 {
     // Property injections
     foreach ($objectDefinition->getPropertyInjections() as $propertyInjection) {
         $this->injectProperty($object, $propertyInjection);
     }
     // Method injections
     foreach ($objectDefinition->getMethodInjections() as $methodInjection) {
         $methodReflection = new \ReflectionMethod($object, $methodInjection->getMethodName());
         $args = $this->parameterResolver->resolveParameters($methodInjection, $methodReflection);
         $methodReflection->invokeArgs($object, $args);
     }
 }