/** * Возвращет единственный экземпляр данного класса. * @return object - объект класса DB */ public static function getInstance() { if (is_null(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
public static function getInstance() { if (!isset(self::$_instance)) { self::$_instance = new DB(); } return self::$_instance; }
public function getInstance() { if (self::$_instance === null) { self::$_instance = new self(); } return self::$_instance; }
/** * 单例 * @return instance */ public static function instance() { if (self::$_instance === NULL) { self::$_instance = new self(); } return self::$_instance; }
static function singleton() { if (!self::$_instance instanceof self) { self::$_instance = new self(); } return self::$_instance; }
public static function GetConn() { if (self::$_instance == null) { self::$_instance = new Database(); } return self::$_instance->GetConn(); }
public static function unsetInstance() { self::getInstance()->type = NULL; self::getInstance()->_adapter->closeConnection(); self::getInstance()->_adapter = NULL; self::$_instance = NULL; }
protected static function getInstance() { if (!self::$_instance instanceof self) { self::$_instance = new self(); } return self::$_instance; }
public static function getInstance() { if (null === self::$_instance) { self::$_instance = new DB(Config::get('db.host'), Config::get('db.user'), Config::get('db.password'), Config::get('db.db_name')); } return self::$_instance; }
/** * M�todo que se usa para obtener una �nica instancia del objeto DB. * Si dicha instancia no existe, la crea. Una vez creada la devuelve. * * @return DB Instancia del objeto DB */ public static function singleton() { if (self::$_instance == null) { self::$_instance = new self(); } return self::$_instance; }
/** * Singleton initial. */ public static function instance() { if (empty(self::$_instance) === true) { self::$_instance = new self(); } return self::$_instance; }
public static function instance($reset = false) { if (!isset(self::$_instance) || $reset) { self::$_instance = new DB(); } return self::$_instance; }
public static function getInstance() { if (!isset(self::$_instance) || get_class(self::$_instance) !== 'DB') { self::$_instance = new DB(); } return self::$_instance; }
public static function _getInstance() { if (!self::$_instance instanceof self) { self::$_instance = new self(); } return self::$_instance; }
public static function connect() { if (!isset(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
/** * Получаем инстанс * @static * @return DB */ public static function &getInstance() { if (!self::$_instance instanceof DB) { self::$_instance = new DB(); } return self::$_instance; }
/** * getInstance */ protected static function getInstance($file = NULL) { if (!isset(self::$_instance)) { $class = __CLASS__; self::$_instance = new $class($file); } return self::$_instance; }
public static function getInstance() { if (!self::$_instance) { // If no instance then make one self::$_instance = new self(); } return self::$_instance; }
private static function getInstance() { if (self::$_instance == null) { $class = __CLASS__; self::$_instance = new $class(); } return self::$_instance; }
public static function singleton() { if (!isset(self::$_instance)) { $c = __CLASS__; self::$_instance = new $c(); } return self::$_instance->mysql; }
public static function table($table_name) { if (!self::$_instance instanceof DB) { self::$_instance = new DB(); } self::$_instance->_table_name = $table_name; return self::$_instance; }
static function GetInstance() { if (!self::$_instance instanceof self) { self::$_instance = new self(); self::$_instance->connect(); } return self::$_instance; }
/** * Inicializa la clase en caso de ser necesario */ public static function init() { if (!self::$_instance instanceof self) { self::$_instance = new self(); } //fin if return self::$_instance; }
public static function getInstance() { //instanceof 判断一个对象是否是这个类的实例 if (!self::$_instance instanceof DB) { self::$_instance = new DB(); } return self::$_instance; }
public static function DBInstance() { if (isset(self::$_instance)) { return self::$_instance; } else { } return self::$_instance = new self(); }
static function getInstance() { if (is_null(self::$_instance)) { self::$_instance = new self(); self::$_instance->setDbName(); } return self::$_instance; }
public static function getInstance() { //Checks if instance already created else creates a new Instance if (!isset(self::$_instance)) { self::$_instance = new DB(); } return self::$_instance; }
public static function getInstance() { if (self::$_instance === NULL) { require_once '../private/inc.db.php'; // call constructor and assign instance self::$_instance = new self($dsn, $user, $password); } return self::$_instance; }
public static function getInstance() { //if the instance isn't set then create an new instance if (!isset(self::$_instance)) { self::$_instance = new DB(); } //else return the instance return self::$_instance; }
public static function getInstance() { if (!isset(self::$_instance)) { //if instance of PDO connection doesn't exist self::$_instance = new DB(); //create a new one } return self::$_instance; }