original_string: public function group($fields, $overwrite = false)
      {
          if ($overwrite) {
              $this->_parts['group'] = [];
          }
  
          if (!is_array($fields)) {
              $fields = [$fields];
          }
  
          $this->_parts['group'] = array_merge($this->_parts['group'], array_values($fields));
          $this->_dirty();
  
          return $this;
      }
code: public function group($fields, $overwrite = false)
      {
          if ($overwrite) {
              $this->_parts['group'] = [];
          }
  
          if (!is_array($fields)) {
              $fields = [$fields];
          }
  
          $this->_parts['group'] = array_merge($this->_parts['group'], array_values($fields));
          $this->_dirty();
  
          return $this;
      }
code_tokens: public function group ( $ fields , $ overwrite = false ) { if ( $ overwrite ) { $ this -> _parts [ 'group' ] = [ ] ; } if ( ! is_array ( $ fields ) ) { $ fields = [ $ fields ] ; } $ this -> _parts [ 'group' ] = array_merge ( $ this -> _parts [ 'group' ] , array_values ( $ fields ) ) ; $ this -> _dirty ( ) ; return $ this ; }
docstring: Adds a single or multiple fields to be used in the GROUP BY clause for this query.
  Fields can be passed as an array of strings, array of expression
  objects, a single expression or a single string.
  
  By default this function will append any passed argument to the list of fields
  to be grouped, unless the second argument is set to true.
  
  ### Examples:
  
  ```
  // Produces GROUP BY id, title
  $query->group(['id', 'title']);
  
  // Produces GROUP BY title
  $query->group('title');
  ```
  
  Group fields are not suitable for use with user supplied data as they are
  not sanitized by the query builder.
  
  @param array|\Cake\Database\ExpressionInterface|string $fields fields to be added to the list
  @param bool $overwrite whether to reset fields with passed list or not
  @return $this
docstring_tokens: Adds a single or multiple fields to be used in the GROUP BY clause for this query . Fields can be passed as an array of strings array of expression objects a single expression or a single string .