/** * Invokes a function after resolving its parameters. * * @param callable $function The function to invoke. * @param array $parameters An associative array of parameters that will take precedence over the resolver. * * @return mixed The result of the function call. * * @throws UnresolvedValueException If a function parameter could not be resolved. */ public function invoke(callable $function, array $parameters = []) { $reflection = $this->reflectionTools->getReflectionFunction($function); $parameters = $this->getFunctionParameters($reflection, $parameters); return call_user_func_array($function, $parameters); }