original_string: public static function is_contact(int $userid, int $contactid) : bool {
          global $DB;
  
          $sql = "SELECT id
                    FROM {message_contacts} mc
                   WHERE (mc.userid = ? AND mc.contactid = ?)
                      OR (mc.userid = ? AND mc.contactid = ?)";
          return $DB->record_exists_sql($sql, [$userid, $contactid, $contactid, $userid]);
      }
code: public static function is_contact(int $userid, int $contactid) : bool {
          global $DB;
  
          $sql = "SELECT id
                    FROM {message_contacts} mc
                   WHERE (mc.userid = ? AND mc.contactid = ?)
                      OR (mc.userid = ? AND mc.contactid = ?)";
          return $DB->record_exists_sql($sql, [$userid, $contactid, $contactid, $userid]);
      }
code_tokens: public static function is_contact ( int $ userid , int $ contactid ) : bool { global $ DB ; $ sql = "SELECT id
                    FROM {message_contacts} mc
                   WHERE (mc.userid = ? AND mc.contactid = ?)
                      OR (mc.userid = ? AND mc.contactid = ?)" ; return $ DB -> record_exists_sql ( $ sql , [ $ userid , $ contactid , $ contactid , $ userid ] ) ; }
docstring: Checks if users are already contacts.
  
  @param int $userid The id of one of the users
  @param int $contactid The id of the other user
  @return bool Returns true if they are a contact, false otherwise
docstring_tokens: Checks if users are already contacts .