driver = strtolower($driver); $dsn = $this->buildDsn(); parent::__construct($dsn, $this->username, $this->password, $this->options); } /** * @return string */ private function buildDsn(): string { return match ($this->driver) { 'pgsql', 'postgresql' => 'pgsql:host=' . $this->host . ';dbname=' . $this->database, default => 'mysql:dbname=' . $this->database . ';host=' . $this->host, }; } }