protected function parseSshConfigFile($file)
    {
        if (!file_exists($file) || !is_readable($file)) {
            throw new RuntimeException("The file '$file' does not exist or is not readable");
        }
        $contents = file_get_contents($file);
        $configs = array();
        $lineNumber = 1;
        foreach (explode(PHP_EOL, $contents) as $line) {
            $line = trim($line);
            if ($line == '' || $line[0] == '#') {
                continue;
            }
            $pos = strpos($line, '=');
            if ($pos !== false) {
                $key = strtolower(trim(substr($line, 0, $pos)));
                $value = trim(substr($line, $pos + 1, strlen($line)));
            } else {
                $i = 0;
                while ($i < strlen($line)) {
                    if ($line[$i] == ' ') {
                        break;
                    }
                    $i++;
                }
                if ($i == strlen($line)) {
                    throw new RuntimeException("The file '$file' is not parsable at line '$lineNumber'");
                }
                $key = strtolower(trim(substr($line, 0, $i)));
                $value = trim(substr($line, $i + 1, strlen($line)));
            }
            if ($key == 'host') {
                $this->configs = array_merge($this->configs, $configs);
                $configs = array();
                $hosts = explode(' ', $value);
                foreach ($hosts as $host) {
                    $configs[] = array('host' => $host);
                }

            } else {
                foreach ($configs as $host => $config) {
                    $configs[$host][$key] = $value;
                }
            }
            $lineNumber++;
        }
        $this->configs = array_merge($this->configs, $configs);
    }