/**
  * Singleton method
  * @return DbConnection
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new self(DB_HOST, DB_USER, DB_PASS, DB_NAME);
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new DbConnection();
     }
     return self::$instance;
 }
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new DbConnection('localhost', 'root', '', 'my_site');
     }
     return self::$instance;
 }
Ejemplo n.º 4
0
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new DbConnection(DB_URL, DB_USER, DB_PWD, DB_NAME);
     }
     return self::$instance;
 }
Ejemplo n.º 5
0
 public static function getInstance()
 {
     $params = (require_once 'dbconfig.php');
     if (is_null(self::$instance)) {
         self::$instance = new DbConnection($params['host'], $params['user'], $params['password'], $params['dbname']);
     }
     return self::$instance;
 }
Ejemplo n.º 6
0
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         // todo: вынести параметры подключения в отдельный файл
         self::$instance = new DbConnection('localhost', 'root', '', 'my_site');
     }
     return self::$instance;
 }