original_string: private function format_connection_string() {
  		if (!in_array($this->dbtype, ['sqlite3', 'mysql', 'pgsql'])) {
  			$this->verified_params = null;
  			self::$logger->error(sprintf(
  				"SQL: database not supported: '%s'.",
  				$this->dbtype));
  			throw new SQLError(SQLError::DBTYPE_ERROR,
  				$this->dbtype . " not supported.");
  		}
  
  		if ($this->dbtype == 'sqlite3')
  			return $this->connection_string = 'sqlite:' . $this->dbname;
  
  		if (!$this->dbuser) {
  			$this->verified_params = null;
  			self::$logger->error(
  				"SQL: param not supplied: 'dbuser'.");
  			throw new SQLError(
  				SQLError::CONNECTION_ARGS_ERROR,
  				"'dbuser' not supplied.");
  		}
  
  		$cstr = sprintf("%s:dbname=%s", $this->dbtype, $this->dbname);
  		if ($this->dbhost) {
  			$cstr .= sprintf(';host=%s', $this->dbhost);
  			if ($this->dbport)
  				$cstr .= sprintf(';port=%s', $this->dbport);
  		}
  
  		if ($this->dbtype == 'mysql')
  			# mysql uses dbuser and dbpass on PDO constructor
  			return $this->connection_string = $cstr;
  
  		$cstr .= sprintf(";user=%s", $this->dbuser);
  		if ($this->dbpass)
  			$cstr .= sprintf(";password=%s", $this->dbpass);
  		return $this->connection_string = $cstr;
  	}
code: private function format_connection_string() {
  		if (!in_array($this->dbtype, ['sqlite3', 'mysql', 'pgsql'])) {
  			$this->verified_params = null;
  			self::$logger->error(sprintf(
  				"SQL: database not supported: '%s'.",
  				$this->dbtype));
  			throw new SQLError(SQLError::DBTYPE_ERROR,
  				$this->dbtype . " not supported.");
  		}
  
  		if ($this->dbtype == 'sqlite3')
  			return $this->connection_string = 'sqlite:' . $this->dbname;
  
  		if (!$this->dbuser) {
  			$this->verified_params = null;
  			self::$logger->error(
  				"SQL: param not supplied: 'dbuser'.");
  			throw new SQLError(
  				SQLError::CONNECTION_ARGS_ERROR,
  				"'dbuser' not supplied.");
  		}
  
  		$cstr = sprintf("%s:dbname=%s", $this->dbtype, $this->dbname);
  		if ($this->dbhost) {
  			$cstr .= sprintf(';host=%s', $this->dbhost);
  			if ($this->dbport)
  				$cstr .= sprintf(';port=%s', $this->dbport);
  		}
  
  		if ($this->dbtype == 'mysql')
  			# mysql uses dbuser and dbpass on PDO constructor
  			return $this->connection_string = $cstr;
  
  		$cstr .= sprintf(";user=%s", $this->dbuser);
  		if ($this->dbpass)
  			$cstr .= sprintf(";password=%s", $this->dbpass);
  		return $this->connection_string = $cstr;
  	}
code_tokens: private function format_connection_string ( ) { if ( ! in_array ( $ this -> dbtype , [ 'sqlite3' , 'mysql' , 'pgsql' ] ) ) { $ this -> verified_params = null ; self :: $ logger -> error ( sprintf ( "SQL: database not supported: '%s'." , $ this -> dbtype ) ) ; throw new SQLError ( SQLError :: DBTYPE_ERROR , $ this -> dbtype . " not supported." ) ; } if ( $ this -> dbtype == 'sqlite3' ) return $ this -> connection_string = 'sqlite:' . $ this -> dbname ; if ( ! $ this -> dbuser ) { $ this -> verified_params = null ; self :: $ logger -> error ( "SQL: param not supplied: 'dbuser'." ) ; throw new SQLError ( SQLError :: CONNECTION_ARGS_ERROR , "'dbuser' not supplied." ) ; } $ cstr = sprintf ( "%s:dbname=%s" , $ this -> dbtype , $ this -> dbname ) ; if ( $ this -> dbhost ) { $ cstr .= sprintf ( ';host=%s' , $ this -> dbhost ) ; if ( $ this -> dbport ) $ cstr .= sprintf ( ';port=%s' , $ this -> dbport ) ; } if ( $ this -> dbtype == 'mysql' ) # mysql uses dbuser and dbpass on PDO constructor return $ this -> connection_string = $ cstr ; $ cstr .= sprintf ( ";user=%s" , $ this -> dbuser ) ; if ( $ this -> dbpass ) $ cstr .= sprintf ( ";password=%s" , $ this -> dbpass ) ; return $ this -> connection_string = $ cstr ; }
docstring: Verify and format connection string.
docstring_tokens: Verify and format connection string .