original_string: public function sort_by_many_fields($a, $b) {
          foreach ($this->sortfields as $field => $mult) {
              // Nulls first.
              if (is_null($a->$field) && !is_null($b->$field)) {
                  return -$mult;
              }
              if (is_null($b->$field) && !is_null($a->$field)) {
                  return $mult;
              }
  
              if (is_string($a->$field) || is_string($b->$field)) {
                  // String fields.
                  if ($cmp = strcoll($a->$field, $b->$field)) {
                      return $mult * $cmp;
                  }
              } else {
                  // Int fields.
                  if ($a->$field > $b->$field) {
                      return $mult;
                  }
                  if ($a->$field < $b->$field) {
                      return -$mult;
                  }
              }
          }
          return 0;
      }
code: public function sort_by_many_fields($a, $b) {
          foreach ($this->sortfields as $field => $mult) {
              // Nulls first.
              if (is_null($a->$field) && !is_null($b->$field)) {
                  return -$mult;
              }
              if (is_null($b->$field) && !is_null($a->$field)) {
                  return $mult;
              }
  
              if (is_string($a->$field) || is_string($b->$field)) {
                  // String fields.
                  if ($cmp = strcoll($a->$field, $b->$field)) {
                      return $mult * $cmp;
                  }
              } else {
                  // Int fields.
                  if ($a->$field > $b->$field) {
                      return $mult;
                  }
                  if ($a->$field < $b->$field) {
                      return -$mult;
                  }
              }
          }
          return 0;
      }
code_tokens: public function sort_by_many_fields ( $ a , $ b ) { foreach ( $ this -> sortfields as $ field => $ mult ) { // Nulls first. if ( is_null ( $ a -> $ field ) && ! is_null ( $ b -> $ field ) ) { return - $ mult ; } if ( is_null ( $ b -> $ field ) && ! is_null ( $ a -> $ field ) ) { return $ mult ; } if ( is_string ( $ a -> $ field ) || is_string ( $ b -> $ field ) ) { // String fields. if ( $ cmp = strcoll ( $ a -> $ field , $ b -> $ field ) ) { return $ mult * $ cmp ; } } else { // Int fields. if ( $ a -> $ field > $ b -> $ field ) { return $ mult ; } if ( $ a -> $ field < $ b -> $ field ) { return - $ mult ; } } } return 0 ; }
docstring: Sorts the two records based upon many fields.
  
  This method should not be called itself, please call $sort instead.
  It has been marked as access private as such.
  
  @access private
  @param stdClass $a
  @param stdClass $b
  @return int
docstring_tokens: Sorts the two records based upon many fields .