public function removeConnection(Connection $connection): void
    {
        $socket = $connection->getSocket();

        if ($socket->getResource()) {
            $index = $socket->getResourceId();
        } else {
            $index = array_search($connection, $this->connections);
        }

        if (!$index) {
            $this->logger->warning('Could not remove connection: not found');
        }

        unset($this->connections[$index]);
        unset($this->resources[$index]);

        $this->server->notify(
            Server::EVENT_SOCKET_DISCONNECT,
            [$connection->getSocket(), $connection]
        );
    }
public function removeConnection(Connection $connection): void
    {
        $socket = $connection->getSocket();

        if ($socket->getResource()) {
            $index = $socket->getResourceId();
        } else {
            $index = array_search($connection, $this->connections);
        }

        if (!$index) {
            $this->logger->warning('Could not remove connection: not found');
        }

        unset($this->connections[$index]);
        unset($this->resources[$index]);

        $this->server->notify(
            Server::EVENT_SOCKET_DISCONNECT,
            [$connection->getSocket(), $connection]
        );
    }
public function removeConnection ( Connection $ connection ) : void { $ socket = $ connection -> getSocket ( ) ; if ( $ socket -> getResource ( ) ) { $ index = $ socket -> getResourceId ( ) ; } else { $ index = array_search ( $ connection , $ this -> connections ) ; } if ( ! $ index ) { $ this -> logger -> warning ( 'Could not remove connection: not found' ) ; } unset ( $ this -> connections [ $ index ] ) ; unset ( $ this -> resources [ $ index ] ) ; $ this -> server -> notify ( Server :: EVENT_SOCKET_DISCONNECT , [ $ connection -> getSocket ( ) , $ connection ] ) ; }
Removes a connection

@param Connection $connection
Removes a connection