es el patrón singleton
Código PHP:
public function __construct() {
$this->getDbConnection();
}
public function getDbConnection($params = null) {
if($this->db === null) {
$this->db = Db::getInstance($params);
}
return $this->db;
}
public static function getInstance() {
if (!(self::$_instance instanceof self)){
self::$_instance=new self();
}
return self::$_instance;
}