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; } }