original_string: public static function assign_user_tool_data($tool, $user) {
          global $CFG;
  
          $user->city = (!empty($tool->city)) ? $tool->city : "";
          $user->country = (!empty($tool->country)) ? $tool->country : "";
          $user->institution = (!empty($tool->institution)) ? $tool->institution : "";
          $user->timezone = (!empty($tool->timezone)) ? $tool->timezone : "";
          if (isset($tool->maildisplay)) {
              $user->maildisplay = $tool->maildisplay;
          } else if (isset($CFG->defaultpreference_maildisplay)) {
              $user->maildisplay = $CFG->defaultpreference_maildisplay;
          } else {
              $user->maildisplay = 2;
          }
          $user->mnethostid = $CFG->mnet_localhost_id;
          $user->confirmed = 1;
          $user->lang = $tool->lang;
  
          return $user;
      }
code: public static function assign_user_tool_data($tool, $user) {
          global $CFG;
  
          $user->city = (!empty($tool->city)) ? $tool->city : "";
          $user->country = (!empty($tool->country)) ? $tool->country : "";
          $user->institution = (!empty($tool->institution)) ? $tool->institution : "";
          $user->timezone = (!empty($tool->timezone)) ? $tool->timezone : "";
          if (isset($tool->maildisplay)) {
              $user->maildisplay = $tool->maildisplay;
          } else if (isset($CFG->defaultpreference_maildisplay)) {
              $user->maildisplay = $CFG->defaultpreference_maildisplay;
          } else {
              $user->maildisplay = 2;
          }
          $user->mnethostid = $CFG->mnet_localhost_id;
          $user->confirmed = 1;
          $user->lang = $tool->lang;
  
          return $user;
      }
code_tokens: public static function assign_user_tool_data ( $ tool , $ user ) { global $ CFG ; $ user -> city = ( ! empty ( $ tool -> city ) ) ? $ tool -> city : "" ; $ user -> country = ( ! empty ( $ tool -> country ) ) ? $ tool -> country : "" ; $ user -> institution = ( ! empty ( $ tool -> institution ) ) ? $ tool -> institution : "" ; $ user -> timezone = ( ! empty ( $ tool -> timezone ) ) ? $ tool -> timezone : "" ; if ( isset ( $ tool -> maildisplay ) ) { $ user -> maildisplay = $ tool -> maildisplay ; } else if ( isset ( $ CFG -> defaultpreference_maildisplay ) ) { $ user -> maildisplay = $ CFG -> defaultpreference_maildisplay ; } else { $ user -> maildisplay = 2 ; } $ user -> mnethostid = $ CFG -> mnet_localhost_id ; $ user -> confirmed = 1 ; $ user -> lang = $ tool -> lang ; return $ user ; }
docstring: Adds default values for the user object based on the tool provided.
  
  @param \stdClass $tool
  @param \stdClass $user
  @return \stdClass The $user class with added default values
docstring_tokens: Adds default values for the user object based on the tool provided .