Code Duplication    Length = 13-13 lines in 2 locations

locallib.php 2 locations

@@ 1075-1087 (lines=13) @@
1072
            $file = reset($files);
1073
            unset($files);
1074
            $pnoncevalue = null;
1075
            if (!is_null($id)) {
1076
                // Create the nonce component for granting a temporary public access.
1077
                $cache = cache::make_from_params(
1078
                    cache_store::MODE_APPLICATION,
1079
                    'mod_bigbluebuttonbn',
1080
                    'presentationdefault_cache'
1081
                );
1082
                $pnoncekey = sha1(context_system::instance()->id);
1083
                /* The item id was adapted for granting public access to the presentation once in order
1084
                 * to allow BigBlueButton to gather the file. */
1085
                $pnoncevalue = bigbluebuttonbn_generate_nonce();
1086
                $cache->set($pnoncekey, array('value' => $pnoncevalue, 'counter' => 0));
1087
            }
1088
1089
            $url = moodle_url::make_pluginfile_url(
1090
                $file->get_contextid(),
@@ 1118-1130 (lines=13) @@
1115
    $file = reset($files);
1116
    unset($files);
1117
    $pnoncevalue = null;
1118
    if (!is_null($id)) {
1119
        // Create the nonce component for granting a temporary public access.
1120
        $cache = cache::make_from_params(
1121
            cache_store::MODE_APPLICATION,
1122
            'mod_bigbluebuttonbn',
1123
            'presentation_cache'
1124
        );
1125
        $pnoncekey = sha1($id);
1126
        /* The item id was adapted for granting public access to the presentation once in order
1127
         * to allow BigBlueButton to gather the file. */
1128
        $pnoncevalue = bigbluebuttonbn_generate_nonce();
1129
        $cache->set($pnoncekey, array('value' => $pnoncevalue, 'counter' => 0));
1130
    }
1131
    $url = moodle_url::make_pluginfile_url(
1132
        $file->get_contextid(),
1133
        $file->get_component(),