Bridge/MongoDB/ConnectionFactory.php
public function getConnection(string $name = null): Connection
    {
        if (is_null($name) and !is_null($this->defaultConnection)) {
            return $this->defaultConnection;
        }

        if (is_null($name) or !array_key_exists($name, $this->registry)) {
            throw new MongoDBConnectionNameNotFoundException($name);
        }

        return $this->registry[$name];
    }
public function getConnection(string $name = null): Connection
    {
        if (is_null($name) and !is_null($this->defaultConnection)) {
            return $this->defaultConnection;
        }

        if (is_null($name) or !array_key_exists($name, $this->registry)) {
            throw new MongoDBConnectionNameNotFoundException($name);
        }

        return $this->registry[$name];
    }
public function getConnection ( string $ name = null ) : Connection { if ( is_null ( $ name ) and ! is_null ( $ this -> defaultConnection ) ) { return $ this -> defaultConnection ; } if ( is_null ( $ name ) or ! array_key_exists ( $ name , $ this -> registry ) ) { throw new MongoDBConnectionNameNotFoundException ( $ name ) ; } return $ this -> registry [ $ name ] ; }
Gets a connection

@param string $name

@return Connection

@throws MongoDBConnectionNameNotFoundException
Gets a connection