Function hasConnection() does not have $host or $port available in its scope. Updating logger.