public function newInstanceOf($class, array $arguments = [], bool $dependencyInjection = true)
    {
        try {
            // Reflection of class
            $reflectionClass = new \ReflectionClass($class);

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

        if (is_null($constructor)) {
            return $reflectionClass->newInstanceWithoutConstructor();
        } else {
            return $reflectionClass->newInstanceArgs($arguments);
        }
    }