You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
717 B

<?php
namespace Config;
use PDOException;
require_once __DIR__ ."/Connection.php";
class ConnectClass{
private string $dsn;
private string $login;
private string $password;
function __construct(){
$this->dsn = "mysql:host=".$_ENV["HOST"].";dbname=".$_ENV["DATABASE"].";";
$this->login = $_ENV["USER"];
$this->password = $_ENV["PASSWORD"];
}
function connect(): int|Connection
{
try {
echo "OKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK";
$connection = new Connection($this->dsn,$this->login,$this->password);
}catch (PDOException){
throw new PDOException();
}
return $connection;
}
}