original_string: protected static function export_user_data_contact_requests(int $userid) {
          global $DB;
  
          $context = \context_user::instance($userid);
  
          if ($contactrequests = $DB->get_records_select('message_contact_requests', 'userid = ? OR requesteduserid = ?',
                  [$userid, $userid], 'id ASC')) {
              $contactrequestsdata = [];
              foreach ($contactrequests as $contactrequest) {
                  if ($userid == $contactrequest->requesteduserid) {
                      $maderequest = false;
                      $contactid = $contactrequest->userid;
                  } else {
                      $maderequest = true;
                      $contactid = $contactrequest->requesteduserid;
                  }
  
                  $contactrequestsdata[] = (object) [
                      'contactrequest' => transform::user($contactid),
                      'maderequest' => transform::yesno($maderequest)
                  ];
              }
              writer::with_context($context)->export_data([get_string('contactrequests', 'core_message')],
                  (object) $contactrequestsdata);
          }
      }
code: protected static function export_user_data_contact_requests(int $userid) {
          global $DB;
  
          $context = \context_user::instance($userid);
  
          if ($contactrequests = $DB->get_records_select('message_contact_requests', 'userid = ? OR requesteduserid = ?',
                  [$userid, $userid], 'id ASC')) {
              $contactrequestsdata = [];
              foreach ($contactrequests as $contactrequest) {
                  if ($userid == $contactrequest->requesteduserid) {
                      $maderequest = false;
                      $contactid = $contactrequest->userid;
                  } else {
                      $maderequest = true;
                      $contactid = $contactrequest->requesteduserid;
                  }
  
                  $contactrequestsdata[] = (object) [
                      'contactrequest' => transform::user($contactid),
                      'maderequest' => transform::yesno($maderequest)
                  ];
              }
              writer::with_context($context)->export_data([get_string('contactrequests', 'core_message')],
                  (object) $contactrequestsdata);
          }
      }
code_tokens: protected static function export_user_data_contact_requests ( int $ userid ) { global $ DB ; $ context = \ context_user :: instance ( $ userid ) ; if ( $ contactrequests = $ DB -> get_records_select ( 'message_contact_requests' , 'userid = ? OR requesteduserid = ?' , [ $ userid , $ userid ] , 'id ASC' ) ) { $ contactrequestsdata = [ ] ; foreach ( $ contactrequests as $ contactrequest ) { if ( $ userid == $ contactrequest -> requesteduserid ) { $ maderequest = false ; $ contactid = $ contactrequest -> userid ; } else { $ maderequest = true ; $ contactid = $ contactrequest -> requesteduserid ; } $ contactrequestsdata [ ] = ( object ) [ 'contactrequest' => transform :: user ( $ contactid ) , 'maderequest' => transform :: yesno ( $ maderequest ) ] ; } writer :: with_context ( $ context ) -> export_data ( [ get_string ( 'contactrequests' , 'core_message' ) ] , ( object ) $ contactrequestsdata ) ; } }
docstring: Export the messaging contact requests data.
  
  @param int $userid
docstring_tokens: Export the messaging contact requests data .