public function invokeFunction(string $function, array $arguments = [], bool $dependencyInjection = true)
    {
        try {
            // Reflection of function
            $reflectionFunction = new \ReflectionFunction($function);

            // Dependency injection?
            if ($dependencyInjection) {
                $arguments = $this->getDependencyInjectionParameters($reflectionFunction->getParameters(), $arguments);
            }
        } catch (\Exception $e) {
            throw new InstantiatorException(sprintf('Error during dependency injection of function "%s"', $function), 0, $e);
        }

        return $reflectionFunction->invokeArgs($arguments);
    }
public function invokeFunction(string $function, array $arguments = [], bool $dependencyInjection = true)
    {
        try {
            // Reflection of function
            $reflectionFunction = new \ReflectionFunction($function);

            // Dependency injection?
            if ($dependencyInjection) {
                $arguments = $this->getDependencyInjectionParameters($reflectionFunction->getParameters(), $arguments);
            }
        } catch (\Exception $e) {
            throw new InstantiatorException(sprintf('Error during dependency injection of function "%s"', $function), 0, $e);
        }

        return $reflectionFunction->invokeArgs($arguments);
    }
public function invokeFunction ( string $ function , array $ arguments = [ ] , bool $ dependencyInjection = true ) { try { // Reflection of function $ reflectionFunction = new \ ReflectionFunction ( $ function ) ; // Dependency injection? if ( $ dependencyInjection ) { $ arguments = $ this -> getDependencyInjectionParameters ( $ reflectionFunction -> getParameters ( ) , $ arguments ) ; } } catch ( \ Exception $ e ) { throw new InstantiatorException ( sprintf ( 'Error during dependency injection of function "%s"' , $ function ) , 0 , $ e ) ; } return $ reflectionFunction -> invokeArgs ( $ arguments ) ; }
Invocation of function.

@param string $function            Function name
@param array  $arguments           Arguments
@param bool   $dependencyInjection Dependency injection? (default: true)

@return mixed
@throws \Berlioz\ServiceContainer\Exception\InstantiatorException
Invocation of function .