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')
            );
        }
    }
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')
            );
        }
    }
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' ) ) ; } }
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.
Get and export a user preference .