original_string: public static function does_contact_request_exist(int $userid, int $requesteduserid) : bool {
          global $DB;
  
          $sql = "SELECT id
                    FROM {message_contact_requests} mcr
                   WHERE (mcr.userid = ? AND mcr.requesteduserid = ?)
                      OR (mcr.userid = ? AND mcr.requesteduserid = ?)";
          return $DB->record_exists_sql($sql, [$userid, $requesteduserid, $requesteduserid, $userid]);
      }
code: public static function does_contact_request_exist(int $userid, int $requesteduserid) : bool {
          global $DB;
  
          $sql = "SELECT id
                    FROM {message_contact_requests} mcr
                   WHERE (mcr.userid = ? AND mcr.requesteduserid = ?)
                      OR (mcr.userid = ? AND mcr.requesteduserid = ?)";
          return $DB->record_exists_sql($sql, [$userid, $requesteduserid, $requesteduserid, $userid]);
      }
code_tokens: public static function does_contact_request_exist ( int $ userid , int $ requesteduserid ) : bool { global $ DB ; $ sql = "SELECT id
                    FROM {message_contact_requests} mcr
                   WHERE (mcr.userid = ? AND mcr.requesteduserid = ?)
                      OR (mcr.userid = ? AND mcr.requesteduserid = ?)" ; return $ DB -> record_exists_sql ( $ sql , [ $ userid , $ requesteduserid , $ requesteduserid , $ userid ] ) ; }
docstring: Checks if a contact request already exists between users.
  
  @param int $userid The id of the user who is creating the contact request
  @param int $requesteduserid The id of the user being requested
  @return bool Returns true if a contact request exists, false otherwise
docstring_tokens: Checks if a contact request already exists between users .