Code Duplication    Length = 10-11 lines in 2 locations

locallib.php 2 locations

@@ 982-992 (lines=11) @@
979
            $file = reset($files);
980
            unset($files);
981
            $pnoncevalue = null;
982
            if (!is_null($id)) {
983
                // Create the nonce component for granting a temporary public access.
984
                $cache = cache::make_from_params(cache_store::MODE_APPLICATION,
985
                    'mod_bigbluebuttonbn',
986
                    'presentationdefault_cache');
987
                $pnoncekey = sha1(context_system::instance()->id);
988
                /* The item id was adapted for granting public access to the presentation once in order
989
                 * to allow BigBlueButton to gather the file. */
990
                $pnoncevalue = bigbluebuttonbn_generate_nonce();
991
                $cache->set($pnoncekey, array('value' => $pnoncevalue, 'counter' => 0));
992
            }
993
994
            $url = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(),
995
                $file->get_filearea(), $pnoncevalue, $file->get_filepath(), $file->get_filename());
@@ 1011-1020 (lines=10) @@
1008
    $file = reset($files);
1009
    unset($files);
1010
    $pnoncevalue = null;
1011
    if (!is_null($id)) {
1012
        // Create the nonce component for granting a temporary public access.
1013
        $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn',
1014
            'presentation_cache');
1015
        $pnoncekey = sha1($id);
1016
        /* The item id was adapted for granting public access to the presentation once in order
1017
         * to allow BigBlueButton to gather the file. */
1018
        $pnoncevalue = bigbluebuttonbn_generate_nonce();
1019
        $cache->set($pnoncekey, array('value' => $pnoncevalue, 'counter' => 0));
1020
    }
1021
    $url = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(),
1022
        $file->get_filearea(), $pnoncevalue, $file->get_filepath(), $file->get_filename());
1023
    return array('name' => $file->get_filename(), 'icon' => file_file_icon($file, 24),