Example #1
0
 /**
  * Возвращет единственный экземпляр данного класса.
  * @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;
 }
Example #3
0
File: db.php Project: blrik/bPost
 public function getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #4
0
 /**
  * 单例
  * @return instance
  */
 public static function instance()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #5
0
 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();
 }
Example #7
0
 public static function unsetInstance()
 {
     self::getInstance()->type = NULL;
     self::getInstance()->_adapter->closeConnection();
     self::getInstance()->_adapter = NULL;
     self::$_instance = NULL;
 }
Example #8
0
 protected static function getInstance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #9
0
 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;
 }
Example #10
0
 /**
  * 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;
 }
Example #11
0
 /**
  * Singleton initial.
  */
 public static function instance()
 {
     if (empty(self::$_instance) === true) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #12
0
 public static function instance($reset = false)
 {
     if (!isset(self::$_instance) || $reset) {
         self::$_instance = new DB();
     }
     return self::$_instance;
 }
Example #13
0
 public static function getInstance()
 {
     if (!isset(self::$_instance) || get_class(self::$_instance) !== 'DB') {
         self::$_instance = new DB();
     }
     return self::$_instance;
 }
Example #14
0
 public static function _getInstance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #15
0
 public static function connect()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #16
0
File: db.php Project: pnixx/boot
 /**
  * Получаем инстанс
  * @static
  * @return DB
  */
 public static function &getInstance()
 {
     if (!self::$_instance instanceof DB) {
         self::$_instance = new DB();
     }
     return self::$_instance;
 }
Example #17
0
 /**
  * getInstance
  */
 protected static function getInstance($file = NULL)
 {
     if (!isset(self::$_instance)) {
         $class = __CLASS__;
         self::$_instance = new $class($file);
     }
     return self::$_instance;
 }
Example #18
0
 public static function getInstance()
 {
     if (!self::$_instance) {
         // If no instance then make one
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #19
0
 private static function getInstance()
 {
     if (self::$_instance == null) {
         $class = __CLASS__;
         self::$_instance = new $class();
     }
     return self::$_instance;
 }
Example #20
0
 public static function singleton()
 {
     if (!isset(self::$_instance)) {
         $c = __CLASS__;
         self::$_instance = new $c();
     }
     return self::$_instance->mysql;
 }
Example #21
0
 public static function table($table_name)
 {
     if (!self::$_instance instanceof DB) {
         self::$_instance = new DB();
     }
     self::$_instance->_table_name = $table_name;
     return self::$_instance;
 }
Example #22
0
 static function GetInstance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
         self::$_instance->connect();
     }
     return self::$_instance;
 }
Example #23
0
 /**
  * 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;
 }
Example #24
0
 public static function getInstance()
 {
     //instanceof  判断一个对象是否是这个类的实例
     if (!self::$_instance instanceof DB) {
         self::$_instance = new DB();
     }
     return self::$_instance;
 }
Example #25
0
 public static function DBInstance()
 {
     if (isset(self::$_instance)) {
         return self::$_instance;
     } else {
     }
     return self::$_instance = new self();
 }
Example #26
0
 static function getInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new self();
         self::$_instance->setDbName();
     }
     return self::$_instance;
 }
Example #27
0
 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;
 }
Example #28
0
 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;
 }
Example #29
0
 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;
 }
Example #30
0
 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;
 }