Version 3.0

New technologies
This commit is contained in:
2022-08-05 21:28:59 -04:00
parent 06071884c7
commit a9968dec58
69 changed files with 600 additions and 2696 deletions

View File

@ -0,0 +1,27 @@
<?php
namespace Contabilidad\Implement\Database;
use Common\Alias\Database;
class MySQL extends Database
{
public function __construct(string $host, string $username, string $password, string $database_name, int $port = 3306)
{
$this->setHost($host, $port);
$this->setUser($username, $password);
$this->setName($database_name);
}
public function getDsn(): string
{
$dsn = ["mysql:host={$this->getHost()}"];
if ($this->getPort() !== 3306) {
$dsn []= "port={$this->getPort()}";
}
$dsn []= "dbname={$this->getName()}";
return implode(';', $dsn);
}
public function needsUser(): bool
{
return true;
}
}