Exemple #1
0
 /**
  * @param \ReflectionMethod $method
  * @param array $args
  * @param callable $parameterFilter
  * @return array Of the injected arguments
  * @throws InjectionException
  */
 public function injectMethodArguments(\ReflectionMethod $method, array $args, $parameterFilter)
 {
     $analyzer = new MethodAnalyzer($method);
     try {
         return $analyzer->fillParameters($args, $this->injector, $parameterFilter);
     } catch (\InvalidArgumentException $e) {
         throw new InjectionException("Cannot inject method [{$method->getDeclaringClass()->getName()}" . "::{$method->getName()}]: " . $e->getMessage(), 0, $e);
     }
 }
Exemple #2
0
 /**
  * @param mixed[] $parameters Values indexed by name
  * @return mixed the result of the execution
  * @throws \Exception if Action cannot be executed
  */
 public function execute(array $parameters)
 {
     $injector = function () {
     };
     $filter = function () {
         return true;
     };
     $analyzer = new MethodAnalyzer($this->method);
     $arguments = $analyzer->fillParameters($parameters, $injector, $filter);
     return $this->method->invokeArgs($this->object, $arguments);
 }