From 50bd59498dcf1502b969e4312f542edfbf208205 Mon Sep 17 00:00:00 2001 From: Aldarien Date: Wed, 13 Oct 2021 22:46:32 -0300 Subject: [PATCH] MySQL Engine --- src/MySQL.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/MySQL.php diff --git a/src/MySQL.php b/src/MySQL.php new file mode 100644 index 0000000..1cf17a0 --- /dev/null +++ b/src/MySQL.php @@ -0,0 +1,32 @@ + $host + ]; + if ($port !== null) { + $host_arr['port'] = $port; + } + $this->host = (object) $host_arr; + $this->name = $name; + } + public function dsn(): string { + $dsn = [ + 'host=' . $this->host->name + ]; + if (isset($this->host->port)) { + $dsn []= 'port=' . $this->host->port; + } + $dsn []= 'dbname=' . $this->name; + return 'mysql:' . implode(';', $dsn); + } + public function hasLogin(): bool { + return true; + } +} \ No newline at end of file