public function connect()
    {
        $dsnString = "{$this->dbDriver}:host={$this->dbHostname};dbname={$this->dbName};";
        $dsnString .= "charset={$this->dbCharset}";
        /*
         * Try to connect to database
         */
        try {
            $this->dbConnection = new \PDO(
                $dsnString,
                "{$this->dbUsername}",
                "{$this->dbPassword}",
                $this->driverOptions
            );
        } catch (\PDOException $ex) {
            // Error during database connection, check params.
            throw new \InvalidArgumentException(
                __METHOD__.': '.$ex->getMessage()
            );
        }

        return $this->dbConnection;
    }
public function connect()
    {
        $dsnString = "{$this->dbDriver}:host={$this->dbHostname};dbname={$this->dbName};";
        $dsnString .= "charset={$this->dbCharset}";
        /*
         * Try to connect to database
         */
        try {
            $this->dbConnection = new \PDO(
                $dsnString,
                "{$this->dbUsername}",
                "{$this->dbPassword}",
                $this->driverOptions
            );
        } catch (\PDOException $ex) {
            // Error during database connection, check params.
            throw new \InvalidArgumentException(
                __METHOD__.': '.$ex->getMessage()
            );
        }

        return $this->dbConnection;
    }
public function connect ( ) { $ dsnString = "{$this->dbDriver}:host={$this->dbHostname};dbname={$this->dbName};" ; $ dsnString .= "charset={$this->dbCharset}" ; /*
         * Try to connect to database
         */ try { $ this -> dbConnection = new \ PDO ( $ dsnString , "{$this->dbUsername}" , "{$this->dbPassword}" , $ this -> driverOptions ) ; } catch ( \ PDOException $ ex ) { // Error during database connection, check params. throw new \ InvalidArgumentException ( __METHOD__ . ': ' . $ ex -> getMessage ( ) ) ; } return $ this -> dbConnection ; }
Connect to a database by using constructor params

@return PDO

@throws \Exception
Connect to a database by using constructor params