v0.1.0
This commit is contained in:
21
provm/common/Service/Database/MySQL.php
Normal file
21
provm/common/Service/Database/MySQL.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
namespace ProVM\Common\Service\Database;
|
||||
|
||||
class MySQL {
|
||||
protected $settings;
|
||||
public function __construct($settings) {
|
||||
$this->settings = $settings;
|
||||
}
|
||||
public function dsn(): string {
|
||||
$dsn = (new DSN($this->settings->engine))
|
||||
->addPair('host', $this->settings->host->name);
|
||||
if (isset($this->settings->host->port)) {
|
||||
$dsn->addPair('port', $this->settings->host->port);
|
||||
}
|
||||
$dsn->addPair('dbname', $this->settings->name);
|
||||
return '' . $dsn;
|
||||
}
|
||||
public function hasUser(): bool {
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user