This commit is contained in:
2024-07-23 01:22:16 +02:00
parent 85d20e034a
commit 1bff7f46d7
9 changed files with 40 additions and 12 deletions
+13 -2
View File
@@ -3,17 +3,28 @@
namespace Khofmann\Database;
use PDO;
use Config\Config;
use Khofmann\Config\Config;
use Exception;
class Database extends PDO
{
private static array $instances = [];
protected function __construct(string $dsn, string $username = null, string $password = null, array $options = null)
private function __construct(string $dsn, string $username = null, string $password = null, array $options = null)
{
parent::__construct($dsn, $username, $password, $options);
}
private function __clone()
{
throw new Exception("Cannot clone a singleton.");
}
private function __wakeup()
{
throw new Exception("Cannot unserialize a singleton.");
}
public static function getInstance(): Database
{
$cls = static::class;