/** * Returns a string formatted for a database connection * * @return string The DSN format needed by the PDO object */ public function getPDOString() { $pdo_string[] = $this->database_type . ':'; if (!$this->host->isEmpty()) { $pdo_string[] = 'host=' . $this->host . ';'; } if (!$this->port->isEmpty()) { $pdo_string[] = 'port=' . $this->port . ';'; } if (!$this->database_name->isEmpty()) { $pdo_string[] = 'dbname=' . $this->database_name; } return implode('', $pdo_string); }