original_string: protected function connectToServer($username, $password, $database, $hostname, $persistent = false, $type = 'mysql', $port = 3306, $options = []) {
          if(!$this->db) {
              $this->database = $database;
              $this->db = new PDO(sprintf(self::$connectors[$type], $hostname, $port, $database), $username, $password,
                  array_merge(
                      ($persistent !== false ? array(PDO::ATTR_PERSISTENT => true) : []),
                      ($type === 'mysql' ? array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, PDO::ATTR_EMULATE_PREPARES => true) : []),
                      (is_array($options) ? $options : [])
                  )
              );
              $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
          }
      }
code: protected function connectToServer($username, $password, $database, $hostname, $persistent = false, $type = 'mysql', $port = 3306, $options = []) {
          if(!$this->db) {
              $this->database = $database;
              $this->db = new PDO(sprintf(self::$connectors[$type], $hostname, $port, $database), $username, $password,
                  array_merge(
                      ($persistent !== false ? array(PDO::ATTR_PERSISTENT => true) : []),
                      ($type === 'mysql' ? array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, PDO::ATTR_EMULATE_PREPARES => true) : []),
                      (is_array($options) ? $options : [])
                  )
              );
              $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
          }
      }
code_tokens: protected function connectToServer ( $ username , $ password , $ database , $ hostname , $ persistent = false , $ type = 'mysql' , $ port = 3306 , $ options = [ ] ) { if ( ! $ this -> db ) { $ this -> database = $ database ; $ this -> db = new PDO ( sprintf ( self :: $ connectors [ $ type ] , $ hostname , $ port , $ database ) , $ username , $ password , array_merge ( ( $ persistent !== false ? array ( PDO :: ATTR_PERSISTENT => true ) : [ ] ) , ( $ type === 'mysql' ? array ( PDO :: MYSQL_ATTR_USE_BUFFERED_QUERY => true , PDO :: ATTR_EMULATE_PREPARES => true ) : [ ] ) , ( is_array ( $ options ) ? $ options : [ ] ) ) ) ; $ this -> db -> setAttribute ( PDO :: ATTR_ERRMODE , PDO :: ERRMODE_EXCEPTION ) ; } }
docstring: Connect to the database using PDO connection
  @param string $username This should be the username for the chosen database
  @param string $password This should be the password for the chosen database
  @param string $database This should be the database that you wish to connect to
  @param string $hostname The host for the database
  @param boolean $persistent If you want a persistent database connection set to true
  @param string $type The type of connection that you wish to make can be 'mysql', 'cubrid', 'dblib', 'mssql', 'pgsql, or 'sqlite'
  @param int $port The port number to connect to the MySQL server
  @param array $options Add any additional PDO connection options here
docstring_tokens: Connect to the database using PDO connection