Example #1
0
 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #2
0
 /**
  * Allow only one instance of this class exist
  * for a single request
  */
 public static function instance()
 {
     $called = get_called_class();
     if (self::$instance instanceof self) {
         return self::$instance;
     }
     return self::$instance = new self();
 }
Example #3
0
 public static function getInstance()
 {
     return self::$_instance ?: (self::$_instance = new self());
 }