src/Connection.php
public function connect() {
        if ($this->_node !== null)
            return true;
        
        $this->_connect();
        
        $response = $this->syncRequest(new Request\Startup($this->_options));
        
        if ($response instanceof Response\Authenticate){
            $nodeOptions = $this->_node->getOptions();
            
            if (empty($nodeOptions['username']) || empty($nodeOptions['password']))
                throw new Exception('Username and password are required.');
            
            $this->syncRequest(new Request\AuthResponse($nodeOptions['username'], $nodeOptions['password']));
        }
        
        if (!empty($this->_keyspace))
            $this->syncRequest(new Request\Query("USE {$this->_keyspace};"));
        
        return true;
    }
public function connect() {
        if ($this->_node !== null)
            return true;
        
        $this->_connect();
        
        $response = $this->syncRequest(new Request\Startup($this->_options));
        
        if ($response instanceof Response\Authenticate){
            $nodeOptions = $this->_node->getOptions();
            
            if (empty($nodeOptions['username']) || empty($nodeOptions['password']))
                throw new Exception('Username and password are required.');
            
            $this->syncRequest(new Request\AuthResponse($nodeOptions['username'], $nodeOptions['password']));
        }
        
        if (!empty($this->_keyspace))
            $this->syncRequest(new Request\Query("USE {$this->_keyspace};"));
        
        return true;
    }
Connect to database
@throws Exception
@return bool