Use singleton instance directly

This commit is contained in:
Bartek Fabiszewski 2019-05-15 11:48:24 +02:00
parent 69cf9ade47
commit 3966c697b7
4 changed files with 10 additions and 16 deletions

View File

@ -26,7 +26,7 @@
/** /**
* Singleton instance * Singleton instance
* *
* @var mysqli Object instance * @var uDb Object instance
*/ */
protected static $instance; protected static $instance;
@ -40,7 +40,7 @@
/** /**
* Database driver name * Database driver name
* *
* @var String Driver * @var string Driver
*/ */
protected static $driver; protected static $driver;
@ -82,7 +82,7 @@
/** /**
* Returns singleton instance * Returns singleton instance
* *
* @return object Singleton instance * @return uDb Singleton instance
*/ */
public static function getInstance() { public static function getInstance() {
if (!self::$instance) { if (!self::$instance) {

View File

@ -89,10 +89,7 @@
* @return uDb instance * @return uDb instance
*/ */
private static function db() { private static function db() {
if (is_null(self::$db)) { return uDb::getInstance();
self::$db = uDb::getInstance();
}
return self::$db;
} }
/** /**

View File

@ -31,6 +31,9 @@
public $isValid = false; public $isValid = false;
/**
* @var uDb $db
*/
private static $db = null; private static $db = null;
/** /**
@ -66,10 +69,7 @@
* @return uDb instance * @return uDb instance
*/ */
private static function db() { private static function db() {
if (is_null(self::$db)) { return uDb::getInstance();
self::$db = uDb::getInstance();
}
return self::$db;
} }
/** /**
@ -102,7 +102,7 @@
* Add new position to track * Add new position to track
* *
* @param int $userId * @param int $userId
* @param int $time Unix time stamp * @param int $timestamp Unix time stamp
* @param double $lat * @param double $lat
* @param double $lon * @param double $lon
* @param double $altitude Optional * @param double $altitude Optional

View File

@ -67,10 +67,7 @@
* @return uDb instance * @return uDb instance
*/ */
private static function db() { private static function db() {
if (is_null(self::$db)) { return uDb::getInstance();
self::$db = uDb::getInstance();
}
return self::$db;
} }
/** /**