Laravel\Envoy\SSHConfigFile::findConfiguredHost PHP Method

findConfiguredHost() public method

Get the configured SSH host by name or IP.
public findConfiguredHost ( string $host ) : string | null
$host string
return string | null
    public function findConfiguredHost($host)
    {
        list($user, $host) = $this->parseHost($host);
        foreach ($this->groups as $group) {
            if (isset($group['host']) && $group['host'] == $host || isset($group['hostname']) && $group['hostname'] == $host) {
                if (!empty($user)) {
                    // User is not specified in the SSH configuration...
                    if (!isset($group['user'])) {
                        continue;
                    }
                    // User is specified in the SSH configuration but is not the given user....
                    if (isset($group['user']) && $group['user'] != $user) {
                        continue;
                    }
                }
                return $group['host'];
            }
        }
    }