original_string: protected static function get_and_export_user_preference(int $userid, string $userpreference, $transform = false) {
          $prefvalue = get_user_preferences($userpreference, null, $userid);
          if ($prefvalue !== null) {
              if ($transform) {
                  $transformedvalue = transform::yesno($prefvalue);
              } else {
                  $transformedvalue = $prefvalue;
              }
              writer::export_user_preference(
                  'scormreport_basic',
                  $userpreference,
                  $transformedvalue,
                  get_string('privacy:metadata:preference:'.$userpreference, 'scormreport_basic')
              );
          }
      }
code: protected static function get_and_export_user_preference(int $userid, string $userpreference, $transform = false) {
          $prefvalue = get_user_preferences($userpreference, null, $userid);
          if ($prefvalue !== null) {
              if ($transform) {
                  $transformedvalue = transform::yesno($prefvalue);
              } else {
                  $transformedvalue = $prefvalue;
              }
              writer::export_user_preference(
                  'scormreport_basic',
                  $userpreference,
                  $transformedvalue,
                  get_string('privacy:metadata:preference:'.$userpreference, 'scormreport_basic')
              );
          }
      }
code_tokens: protected static function get_and_export_user_preference ( int $ userid , string $ userpreference , $ transform = false ) { $ prefvalue = get_user_preferences ( $ userpreference , null , $ userid ) ; if ( $ prefvalue !== null ) { if ( $ transform ) { $ transformedvalue = transform :: yesno ( $ prefvalue ) ; } else { $ transformedvalue = $ prefvalue ; } writer :: export_user_preference ( 'scormreport_basic' , $ userpreference , $ transformedvalue , get_string ( 'privacy:metadata:preference:' . $ userpreference , 'scormreport_basic' ) ) ; } }
docstring: Get and export a user preference.
  
  @param  int     $userid The userid of the user whose data is to be exported.
  @param  string  $userpreference The user preference to export.
  @param  boolean $transform If true, transform value to yesno.
docstring_tokens: Get and export a user preference .