<?php
/********************************************************************************
 * (c)1337 aheadware.com - All rights reserved
 ********************************************************************************/

/**
 * Class TB_Shared_Db_Core
 */
class TB_Shared_Db_Core {

    // Singleton pattern
    protected static $dbh = NULL;
    private function __construct() {}
    private function __clone() {}

    /**
     * Get single DB instance
     *
     * @return Francis_Db_MySql|null
     */
    public static function get() {
        if ( is_null( self::$dbh ) ) {
            self::$dbh = new Francis_Db_MySql( array(
                'host' => Francis_Utils_Config::get( 'db.tbcore.host' ),
                'name' => Francis_Utils_Config::get( 'db.tbcore.name' ),
                'user' => Francis_Utils_Config::get( 'db.tbcore.user' ),
                'pass' => Francis_Utils_Config::get( 'db.tbcore.pass' )
            ));
        }
        return self::$dbh;
    }
} 