src/Factory/ConfigLoaderFactory.php
private  function ensureDirectoryExists($varDir)
    {
        if (is_dir($varDir) === false) {
            if (file_exists($varDir) === true) {
                throw new \RuntimeException(
                    sprintf(
                        'Could not create directory "%s", file already exists at given location.',
                        $varDir
                    )
                );
            } else {
                /* @NOTE: Error is suppressed with "@" so an exception can be thrown instead of triggering an error */
                /** @noinspection NotOptimalIfConditionsInspection *///No use in checking dir before creation
                if (@mkdir($varDir, 0777, true) === false && is_dir($varDir) === false) {
                    throw new \RuntimeException(sprintf('Could not create directory "%s"', $varDir));
                }
            }
        } elseif (is_writable($varDir) === false) {
            throw new \RuntimeException(sprintf('Could not write in directory "%s"', $varDir));
        }
    }
private  function ensureDirectoryExists($varDir)
    {
        if (is_dir($varDir) === false) {
            if (file_exists($varDir) === true) {
                throw new \RuntimeException(
                    sprintf(
                        'Could not create directory "%s", file already exists at given location.',
                        $varDir
                    )
                );
            } else {
                /* @NOTE: Error is suppressed with "@" so an exception can be thrown instead of triggering an error */
                /** @noinspection NotOptimalIfConditionsInspection *///No use in checking dir before creation
                if (@mkdir($varDir, 0777, true) === false && is_dir($varDir) === false) {
                    throw new \RuntimeException(sprintf('Could not create directory "%s"', $varDir));
                }
            }
        } elseif (is_writable($varDir) === false) {
            throw new \RuntimeException(sprintf('Could not write in directory "%s"', $varDir));
        }
    }
@param string $varDir

@throws \RuntimeException