original_string: public function get_group_by(array $cfg): string
    {
      $res = '';
      $group_to_put = [];
      if ( !empty($cfg['group_by']) ){
        foreach ( $cfg['group_by'] as $g ){
          if ( isset($cfg['available_fields'][$g]) ){
            $group_to_put[] = $this->escape($g);
            //$group_to_put[] = $this->col_full_name($g, $cfg['available_fields'][$g], true);
          }
          else{
            $this->db->error("Error! The column '$g' doesn't exist for group by ".print_r($cfg, true));
          }
        }
        if ( count($group_to_put) ){
          $res .= 'GROUP BY '.implode(', ', $group_to_put).PHP_EOL;
        }
      }
      return $res;
    }
code: public function get_group_by(array $cfg): string
    {
      $res = '';
      $group_to_put = [];
      if ( !empty($cfg['group_by']) ){
        foreach ( $cfg['group_by'] as $g ){
          if ( isset($cfg['available_fields'][$g]) ){
            $group_to_put[] = $this->escape($g);
            //$group_to_put[] = $this->col_full_name($g, $cfg['available_fields'][$g], true);
          }
          else{
            $this->db->error("Error! The column '$g' doesn't exist for group by ".print_r($cfg, true));
          }
        }
        if ( count($group_to_put) ){
          $res .= 'GROUP BY '.implode(', ', $group_to_put).PHP_EOL;
        }
      }
      return $res;
    }
code_tokens: public function get_group_by ( array $ cfg ) : string { $ res = '' ; $ group_to_put = [ ] ; if ( ! empty ( $ cfg [ 'group_by' ] ) ) { foreach ( $ cfg [ 'group_by' ] as $ g ) { if ( isset ( $ cfg [ 'available_fields' ] [ $ g ] ) ) { $ group_to_put [ ] = $ this -> escape ( $ g ) ; //$group_to_put[] = $this->col_full_name($g, $cfg['available_fields'][$g], true); } else { $ this -> db -> error ( "Error! The column '$g' doesn't exist for group by " . print_r ( $ cfg , true ) ) ; } } if ( count ( $ group_to_put ) ) { $ res .= 'GROUP BY ' . implode ( ', ' , $ group_to_put ) . PHP_EOL ; } } return $ res ; }
docstring: Returns a string with the GROUP BY part of the query if there is, empty otherwise
  
  @param array $cfg
  @return string
docstring_tokens: Returns a string with the GROUP BY part of the query if there is empty otherwise