protected static function instantiate($className, $arguments = null, $constructor = null, $includeFilename = null)
    {
        // Include file given?
        if (null !== $includeFilename) {
            include_once $includeFilename;
        }

        // create reflection of class
        $reflectionOfClass = new ReflectionClass($className);

        // Check if class is instantiable
        if (false === $reflectionOfClass->isInstantiable()) {

            // if no constructor given for singleton instantiation try to detect
            if (null === $constructor) {
                $constructor = self::parseConstructor($reflectionOfClass);
            }

            // Instantiate ...
            if (null === $arguments) {
                // ... without any arguments
                return call_user_func($className.'::'.$constructor);
            } else {
                // ... with arguments passed by
                if (is_array($arguments)) {
                    return call_user_func_array($className.'::'.$constructor, $arguments);
                } else {
                    return call_user_func($className.'::'.$constructor, $arguments);
                }
            }
        } else {

            // Check for given arguments
            if ($arguments) {

                // check if parameter is already of type array
                if (!is_array($arguments)) {
                    // if not make array
                    $arguments = [$arguments];
                }

                // return instance with parameter}
                return $reflectionOfClass->newInstanceArgs($arguments);
            } else {
                // return instance without parameter
                return $reflectionOfClass->newInstance();
            }
        }
    }