public function getConfigForHost($host)
    {
        $matches = array();
        foreach ($this->configs as $config) {
            if (fnmatch($config['host'], $host)) {
                $matches[] = $config;
            }
        }
        if (count($matches) == 0) {
            throw new RuntimeException("Unable to find configuration for host '{$host}'");
        }
        usort($matches, function ($a, $b) {
            return strlen($a['host']) > strlen($b['host']);
        });
        $result = array();
        foreach ($matches as $match) {
            $result = array_merge($result, $match);
        }
        unset($result['host']);
        if (isset($result['identityfile'])) {
            $result['identityfile'] = $this->processPath($result['identityfile']);
        } else if (file_exists($file = $this->processPath($this->getIdentity()))) {
            $result['identityfile'] = $file;
        }

        return $result;
    }
public function getConfigForHost($host)
    {
        $matches = array();
        foreach ($this->configs as $config) {
            if (fnmatch($config['host'], $host)) {
                $matches[] = $config;
            }
        }
        if (count($matches) == 0) {
            throw new RuntimeException("Unable to find configuration for host '{$host}'");
        }
        usort($matches, function ($a, $b) {
            return strlen($a['host']) > strlen($b['host']);
        });
        $result = array();
        foreach ($matches as $match) {
            $result = array_merge($result, $match);
        }
        unset($result['host']);
        if (isset($result['identityfile'])) {
            $result['identityfile'] = $this->processPath($result['identityfile']);
        } else if (file_exists($file = $this->processPath($this->getIdentity()))) {
            $result['identityfile'] = $file;
        }

        return $result;
    }
public function getConfigForHost ( $ host ) { $ matches = array ( ) ; foreach ( $ this -> configs as $ config ) { if ( fnmatch ( $ config [ 'host' ] , $ host ) ) { $ matches [ ] = $ config ; } } if ( count ( $ matches ) == 0 ) { throw new RuntimeException ( "Unable to find configuration for host '{$host}'" ) ; } usort ( $ matches , function ( $ a , $ b ) { return strlen ( $ a [ 'host' ] ) > strlen ( $ b [ 'host' ] ) ; } ) ; $ result = array ( ) ; foreach ( $ matches as $ match ) { $ result = array_merge ( $ result , $ match ) ; } unset ( $ result [ 'host' ] ) ; if ( isset ( $ result [ 'identityfile' ] ) ) { $ result [ 'identityfile' ] = $ this -> processPath ( $ result [ 'identityfile' ] ) ; } else if ( file_exists ( $ file = $ this -> processPath ( $ this -> getIdentity ( ) ) ) ) { $ result [ 'identityfile' ] = $ file ; } return $ result ; }
Merges matches of the host in the config file using fnmatch and a length comparison
@param  string $host
@return array
Merges matches of the host in the config file using fnmatch and a length comparison