public function invoke(callable $function, array $parameters = [])
    {
        $reflection = $this->reflectionTools->getReflectionFunction($function);
        $parameters = $this->getFunctionParameters($reflection, $parameters);

        return call_user_func_array($function, $parameters);
    }
public function invoke(callable $function, array $parameters = [])
    {
        $reflection = $this->reflectionTools->getReflectionFunction($function);
        $parameters = $this->getFunctionParameters($reflection, $parameters);

        return call_user_func_array($function, $parameters);
    }
public function invoke ( callable $ function , array $ parameters = [ ] ) { $ reflection = $ this -> reflectionTools -> getReflectionFunction ( $ function ) ; $ parameters = $ this -> getFunctionParameters ( $ reflection , $ parameters ) ; return call_user_func_array ( $ function , $ parameters ) ; }
Invokes a function after resolving its parameters.

If the given parameters match the function parameter names, the given values are used.
Otherwise, the function parameters are resolved using the ValueResolver.

@param callable $function   The function to invoke.
@param array    $parameters An associative array of values for the function parameters.

@return mixed The result of the function call.

@throws UnresolvedValueException If a function parameter could not be resolved.
Invokes a function after resolving its parameters .