Clase PHP para conexión a Base de datos

Aquí les dejo una clase hecha por mi, para la conexión a base de datos MySQL. Esta programada en OOP, y PHP 5.0 o posterior.

<?php

 /**
  * Class Connection
  * Copyright (C) 2012 Pablo Ezequiel Leone
  * Licensed under GNU/GPL - PHP 5.0 or later

  * Usage
  * =====
  * require_once 'Connection.php';                                                    File class required
  * $con = new Connection ('hosttest', 'usertest', 'passtest', 'databasetest');       Create new connection
  * $query = 'SELECT * FROM test';                                                    Query
  * mysql_query($query, $con);                                                        Execute query
  **/

class Connection {

    private $_database = false;
    private $_host;
    private $_username;
    private $_password;
    private $_connection;
    private $_db_selected;

    private function database ($value = false) {
        if ($value) {
            if (empty($value)) {
                throw new Exception ('Empty database name');
            } elseif ( ! is_string($value)) {
                throw new Exception ('Database must be a string');
            } else {
                $this->_database = $value;
            }
        } else {
   return $this->_database;
  }
    }

    private function host ($value = false) {
  if ($value) {
   if (empty($value)) {
    throw new Exception ('Empty host name');
   } elseif ( ! is_string($value)) {
    throw new Exception ('Host must be a string');
   } else {
    $this->_host = $value;
   }
  } else {
   return $this->_host;
  }
    }

    private function username ($value = false) {
  if ($value) {
   if (empty($value)) {
    throw new Exception ('Empty user');
   } elseif ( ! is_string($value)) {
    throw new Exception ('User must be a string');
   } else {
    $this->_username = $value;
   }
  } else {
   return $this->_username;
  }
    }

    private function password ($value = false) {
  if ($value) {
   if (empty($value)) {
    throw new Exception ('Empty password');
   } elseif ( ! is_string($value)) {
    throw new Exception ('Password must be a string');
   } else { 
    $this->_password = $value;
   }
  } else {
   return $this->_password;
  }
    }
 
 private function connection ($value = false) {
  if ($value) {
   if (empty($value)) {
    throw new Exception ('Empty connection');
   } elseif ( ! is_resource($value)) {
    throw new Exception ('Connection must be a resource');
   } else { 
    $this->_connection = $value;
   }
  } else {
   return $this->_connection;
  }
    }

 private function db_selected ($value = false) {
  if ($value) {
   if (empty($value)) {
    throw new Exception ('Empty database selected');
   } elseif ( ! is_resource($value)) {
    throw new Exception ('Database selected must be a resource');
   } else { 
    $this->_db_selected = $value;
   }
  } else {
   return $this->_db_selected;
  }
    }

    /**
    * Connection constructor
    *
    * @param string $host     Database host
    * @param string $username Database user
    * @param string $password Database password
    * @param string $database Database name
    * 
    * @return bool Return connection
    **/
    public function __construct($host, $username, $password, $database = false) {
        try {
            $this->database($database);
            $this->host($host);
            $this->username($username);
            $this->password($password);

            $this->OpenMySqlConnection();
            
            if ($this->database()) {
                $this->SelectMySqlDatabase();
            }

            return $this->connection();
        } catch (Exception $e) {
            echo 'Exception -> ' .$e->getMessage();
        }
    }

    /**
    * Open a new DB connection
    **/
    private function OpenMySqlConnection() { 
        if ( ! $this->connection()) { 
            $this->connection(mysql_connect($this->host(), $this->username(), $this->password()));
            if ( ! $this->connection()) {
                throw new Exception ('Connect error: ' .mysql_error());
            }
        } else {
            throw new Exception ('There are another connection');
        }
    }

    /**
    * Select DB
    **/
    private function SelectMySqlDatabase() { 
        if ($this->connection()) { 
            if ($this->database()) {
                $this->db_selected(mysql_select_db($this->database(), $this->connection()));
                if ( ! $this->db_selected()) {
                    throw new Exception ('Select DB error: ' .mysql_error());
                }
            } else {
                throw new Exception ('No select DB becouse no database');
            }
        } else { 
            throw new Exception ('No select DB becouse no connection');
        }
    }

    /**
    * Close existing DB connection
    **/
    private function CloseMySqlConnection() {
        if ($this->connection()) {
            mysql_close($this->connection());
        } else {
            throw new Exception ('No connection: ' .mysql_error());
        }
    }

    /**
     * Close innecesary data
     **/
    public function __destruct() {
        $this->CloseMySqlConnection();
    }
}