public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new Singleton();
     }
     return self::$_instance;
 }
示例#2
0
 public static function getInstance()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new Singleton();
     }
     return self::$_instance;
 }
示例#3
0
 public static function getInstance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
示例#4
0
 public static function init()
 {
     if (self::$_instance == null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
示例#5
0
 public static function getInstance()
 {
     if (!self::$_instance instanceof self) {
         //instanceof用于检测对象与类的从属关系,is_subclass_of对象所属类是否类的子类
         self::$_instance = new self();
     }
     return self::$_instance;
 }
示例#6
0
 static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new Singleton();
     } else {
         return self::$_instance;
     }
 }
示例#7
0
 /**
  * 获得实例
  * @return null
  */
 public static function getInstance()
 {
     $class = __CLASS__;
     if (!self::$_instance instanceof $class) {
         return self::$_instance = new $class();
     }
     return self::$_instance;
 }
示例#8
0
 /**
  * Сброс инстанции
  *
  * @static
  * @return void
  */
 public static function reset()
 {
     self::$_instance = NULL;
 }