Adds a server to our list of servers

@param string $type The type of server we're trying to add, eg "master", "custom"
@param Server $server The server to add
517137
protected function addServer(string $type, Server $server)
    {
        switch ($type) {
            case 'master':
                $this->servers['master'] = ['server' => $server, 'connection' => null];

                break;
            default:
                $serverHashId = spl_object_hash($server);

                if (!isset($this->servers[$type][$serverHashId])) {
                    $this->servers[$type][$serverHashId] = ['server' => $server, 'connection' => null];
                }

                break;
        }
    }
484153
public void addServerToCache(ServerImpl server) {
        // Remove in case, there's an old instance in cache
        removeServerFromCache(server.getId());

        nonReadyServers.put(server.getId(), server);
        server.addServerReadyConsumer(s -> {
            nonReadyServers.remove(s.getId());
            removeUnavailableServerFromCache(s.getId());
            servers.put(s.getId(), s);
        });
    }
141582
public function addServers(array $servers): self
    {
        foreach ($servers as $hostname => $server) {
            if (!$server instanceof Server && is_array($server)) {
                $host = $server['host'];
                $port = $server['port'] ?? null;
                $database = $server['database'] ?? null;
                $username = $server['username'] ?? null;
                $password = $server['password'] ?? null;
                $options = $server['options'] ?? null;

                $server = new Server($host, $port, $database, $username, $password, $options);
            }

            /* @var Server $server */
            if (!is_string($hostname)) {
                $hostname = $server->getHost();
            }

            $this->addServer($hostname, $server);
        }

        return $this;
    }
967406
public function addServer($tld, $server)
    {
        $this->server[(string) $tld] = (string)$server;
        return $this;
    }
1363794
public function addUser(ServerUser $user)
    {
        if ($this->users->contains($user) === false) {
            $user->setServer($this);
            $this->users->add($user);
        }

        return $this;
    }
956781
public function reload(\Erebot\Interfaces\Config\Server $config)
    {
        $this->loadModules(
            $config,
            \Erebot\Module\Base::RELOAD_ALL
        );
        $this->config = $config;
    }
711959
def add_service_server(service_server)
      @master.register_service(service_server.service_name,
                               service_server.service_uri)
      service_server.set_manager(self)
      @service_servers.push(service_server)
      service_server
    end
259344
public void setServers(java.util.Collection<ListedServer> servers) {
        if (servers == null) {
            this.servers = null;
            return;
        }

        this.servers = new java.util.ArrayList<ListedServer>(servers);
    }
1017233
public function setServer($key, $value = null)
    {
        if (is_array($key)) {
            $this->server = array_merge($this->server, $key);
        } else {
            $this->server[$key] = $value;
        }
    }
471760
public function addType(Type $type)
    {
        $name = $type->getName();

        if (!Type::hasType($name)) {
            Type::addType($name, get_class($type));
        }

        $this->types[$name] = $type;
    }
108894
public function addType(Type $type)
    {
        if ($type instanceof self) {
            foreach ($type->getTypes() as $subType) {
                $this->types[] = $subType;
            }

            return $this;
        }

        $this->types[] = $type;

        return $this;
    }
38253
public function addBlServer(Server $server)
    {
        if (is_null($server->getResolver())) {
            throw new Resolver\NotFoundResolverException('Set the server resolver.');
        }

        $this->blServers[] = $server;

        return $this;
    }
271974
public function initialize(Server $server)
    {
        $server->resourceTypeMapping['Sabre\\CalDAV\\Subscriptions\\ISubscription'] =
            '{http://calendarserver.org/ns/}subscribed';

        $server->xml->elementMap['{http://calendarserver.org/ns/}source'] =
            'Sabre\\DAV\\Xml\\Property\\Href';

        $server->on('propFind', [$this, 'propFind'], 150);
    }
1134183
public function beforeSend(Server $server)
    {

        // Build the server code
        $this->server_code = implode('', array_map('chr', explode('.', $server->ip()))) .
                             pack("S", $server->portClient());

        // Loop over the packets and update them
        foreach ($this->packets as $packetType => $packet) {
            // Fill out the packet with the server info
            $this->packets[$packetType] = sprintf($packet, $this->server_code);
        }
    }
925137
protected function setValues($type)
    {
        switch ($type) {
            case static::CLIENT:
                $this->values = ['cs', 'cr'];
                break;
            case static::SERVER:
                $this->values = ['sr', 'ss'];
                break;
            default:
                throw new \InvalidArgumentException('$type must be TYPE_CLIENT or TYPE_SERVER');
        }
    }
290082
private static void registerServer(Server server, Database db) {

        if (!serverMap.containsKey(server)) {
            serverMap.put(server, new HashSet());
        }

        HashSet databases = (HashSet) serverMap.get(server);

        databases.add(db);
    }
345744
public function bind(Server $server)
    {
        if ($this->isBound()) {
            throw new LogicException('Process can be bound to server only once.');
        }

        $this->server = $server;

        $this->dispatchEvent('Bind', $server, $this);
    }