<?php

namespace Core\Database;

use PDO;

class DB
{
    private static ?PDO $instance = null;

    public static function conn(): PDO
    {
        if (!self::$instance) {

            self::$instance = new PDO(
                "mysql:host=" . $_ENV['DB_HOST'] .
                ";dbname=" . $_ENV['DB_NAME'] .
                ";charset=utf8mb4",

                $_ENV['DB_USER'],
                $_ENV['DB_PASS']
            );
        }

        return self::$instance;
    }
}