public function getDb()
    {
        if (is_null($this->db)) {
            
            //try explicit type setting
            if( $this->getAccessType() == 'mysqli' && function_exists('mysqli_select_db') ){
                $this->db = new Db\Mysqli();
            }
            else 
            {
                if ( $this->getAccessType() == 'pdo' && class_exists('PDO') ){
                    $this->db = new Db\Pdo();
                }
            }
            
            //fuck it; we're just gonna choose one then
            if(is_null($this->db)){
                if( class_exists('PDO') ){
                    $this->db = new Db\Pdo(); 
                }
                elseif ( function_exists('mysqli_select_db') ) {
                    $this->db = new Db\Mysqli();
                }
                else {
                    throw new DbException('Database engine not available! Must be either PDO or mysqli');
                }
            }
            
            $this->db->setCredentials($this->credentials);
        }
        
        return $this->db;
    }
public function getDb()
    {
        if (is_null($this->db)) {
            
            //try explicit type setting
            if( $this->getAccessType() == 'mysqli' && function_exists('mysqli_select_db') ){
                $this->db = new Db\Mysqli();
            }
            else 
            {
                if ( $this->getAccessType() == 'pdo' && class_exists('PDO') ){
                    $this->db = new Db\Pdo();
                }
            }
            
            //fuck it; we're just gonna choose one then
            if(is_null($this->db)){
                if( class_exists('PDO') ){
                    $this->db = new Db\Pdo(); 
                }
                elseif ( function_exists('mysqli_select_db') ) {
                    $this->db = new Db\Mysqli();
                }
                else {
                    throw new DbException('Database engine not available! Must be either PDO or mysqli');
                }
            }
            
            $this->db->setCredentials($this->credentials);
        }
        
        return $this->db;
    }
public function getDb ( ) { if ( is_null ( $ this -> db ) ) { //try explicit type setting if ( $ this -> getAccessType ( ) == 'mysqli' && function_exists ( 'mysqli_select_db' ) ) { $ this -> db = new Db \ Mysqli ( ) ; } else { if ( $ this -> getAccessType ( ) == 'pdo' && class_exists ( 'PDO' ) ) { $ this -> db = new Db \ Pdo ( ) ; } } //fuck it; we're just gonna choose one then if ( is_null ( $ this -> db ) ) { if ( class_exists ( 'PDO' ) ) { $ this -> db = new Db \ Pdo ( ) ; } elseif ( function_exists ( 'mysqli_select_db' ) ) { $ this -> db = new Db \ Mysqli ( ) ; } else { throw new DbException ( 'Database engine not available! Must be either PDO or mysqli' ) ; } } $ this -> db -> setCredentials ( $ this -> credentials ) ; } return $ this -> db ; }
Returns an instance of the database object

@todo Update engine selection to be
polymorphic instead of conditional
@return Db\DbInterface
@throws Exceptions\DbException
Returns an instance of the database object