29 lines
513 B
PHP
29 lines
513 B
PHP
![]() |
<?php
|
||
|
namespace ProVM\Database;
|
||
|
|
||
|
use ProVM\Alias\Database;
|
||
|
|
||
|
class MySQL extends Database
|
||
|
{
|
||
|
public function needsUser(): bool
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public function getDSN(): string
|
||
|
{
|
||
|
$arr = [
|
||
|
"host={$this->getHost()}"
|
||
|
];
|
||
|
if (isset($this->port)) {
|
||
|
$arr []= "port={$this->getPort()}";
|
||
|
}
|
||
|
$arr []= "dbname={$this->getName()}";
|
||
|
|
||
|
return implode(':', [
|
||
|
'mysql',
|
||
|
implode(';', $arr)
|
||
|
]);
|
||
|
}
|
||
|
}
|