<?php
declare (strict_types = 1);
namespace ProxyPay\Core;

class Factory
{
	public static function getDB($persistent = false)
	{
		static $db;
		if (!is_object($db) || ($persistent && !$db->ping())) {
			$config   = Config::get();
			$db = new Db($config->db_host, $config->db_user, $config->db_pass, $config->db_base);
			$db->set_charset("utf8");
		}
		return $db;
	}
}
