Code Duplication    Length = 15-15 lines in 2 locations

src/Drivers/PDO/PDODriver.php 1 location

@@ 70-84 (lines=15) @@
67
	 *
68
	 * @return string DSN
69
	 */
70
	protected function getDSN():string {
71
		$dsn = $this->drivername;
72
73
		if($this->options->socket){
74
			$dsn .= ':unix_socket='.$this->options->socket;
75
		}
76
		else{
77
			$dsn .= ':host='.$this->options->host;
78
			$dsn .= (bool)$this->options->port ? ';port='.$this->options->port : '';
79
		}
80
81
		$dsn .= ';dbname='.$this->options->database;
82
83
		return $dsn;
84
	}
85
86
	/**
87
	 * Establishes a database connection and returns the connection object

src/Drivers/PDO/PDODriverAbstract.php 1 location

@@ 74-88 (lines=15) @@
71
	 *
72
	 * @return string DSN
73
	 */
74
	protected function getDSN():string{
75
		$dsn = $this->drivername;
76
77
		if($this->options->socket){
78
			$dsn .= ':unix_socket='.$this->options->socket;
79
		}
80
		else{
81
			$dsn .= ':host='.$this->options->host;
82
			$dsn .= (bool)$this->options->port ? ';port='.$this->options->port : '';
83
		}
84
85
		$dsn .= ';dbname='.$this->options->database;
86
87
		return $dsn;
88
	}
89
90
	/**
91
	 * Establishes a database connection and returns the connection object