original_string: public function addSort(string $field, $descending = false): self
      {
          $this->fields[$field] = $field.($descending ? '|desc' : '');
  
          return $this;
      }
code: public function addSort(string $field, $descending = false): self
      {
          $this->fields[$field] = $field.($descending ? '|desc' : '');
  
          return $this;
      }
code_tokens: public function addSort ( string $ field , $ descending = false ) : self { $ this -> fields [ $ field ] = $ field . ( $ descending ? '|desc' : '' ) ; return $ this ; }
docstring: Add a sort to this query.
  
  @param string $field      The field to sort on, such as 'id' or 'title'.
  @param bool   $descending (optional) True if results should be sorted descending, false otherwise.
  
  @return self
docstring_tokens: Add a sort to this query .