Code Duplication    Length = 10-11 lines in 2 locations

locallib.php 2 locations

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