Example #1
0
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #2
0
 /**
  * Create unique instance for the class
  *
  * @param void
  * @return Singleton
  */
 public static function getInstance($db)
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new static($db);
     }
     return self::$_instance;
 }
Example #3
0
 /**
  * Return the only instance
  *
  * @return object
  */
 public static function getInstance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #4
0
 public static function getInstance()
 {
     if (!self::$_instance) {
         // If no instance then make one
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #5
0
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new PDOManager('mysql', 'localhost', 'root', 'root', 'ssp_test');
     }
     if (!isset(self::$_instance)) {
         throw new Exception('Database connection cannot be established');
     }
     return self::$_instance;
 }
Example #6
0
 /**
  * 获得类的实例
  * @return mixed|Model
  */
 public static function getStringleton()
 {
     //判断我们类的实例是否存在,没有则创建之
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     //连接数据库
     self::connect(HOST, UNAME, UPASS, DBNAME);
     return self::$_instance;
 }
Example #7
0
 public static function getInstance($host, $user, $password, $database)
 {
     self::$_host = $host;
     self::$_user = $user;
     self::$_password = $password;
     self::$_database = $database;
     if (!self::$_instance) {
         self::$_instance = new Model();
     }
     return self::$_instance;
 }
Example #8
0
 public static function factory($model)
 {
     self::$_className = "Model_" . $model;
     if (!class_exists(self::$_className)) {
         throw new Model_Exception("class model not exists");
     }
     if (self::$_instance === NULL) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #9
0
 /**
  * 单例模式实例化当前模型类
  *
  * @access public
  * @return object
  */
 public static function getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }