protected static function parseEdgeRcFile($path)
    {
        if ($path === null) {
            if (isset($_SERVER['HOME']) && file_exists($_SERVER['HOME'] . '/.edgerc')) {
                $path = $_SERVER['HOME'] . '/.edgerc';
            } elseif (file_exists('./.edgerc')) {
                $path = './.edgerc';
            }
        }

        $file = !$path ? false : realpath($path);
        if (!$file) {
            throw new ConfigException("Path to .edgerc file \"$path\" does not exist!");
        }

        if (!is_readable($file)) {
            throw new ConfigException('Unable to read .edgerc file!');
        }

        // Handle : assignments in .edgerc files
        $ini = file_get_contents($file);
        $ini = str_replace(':', '=', $ini);

        $ini = parse_ini_string($ini, true, INI_SCANNER_RAW);

        return $ini;
    }