Code Duplication    Length = 10-11 lines in 2 locations

locallib.php 2 locations

@@ 1007-1017 (lines=11) @@
1004
            $file = reset($files);
1005
            unset($files);
1006
            $pnoncevalue = null;
1007
            if (!is_null($id)) {
1008
                // Create the nonce component for granting a temporary public access.
1009
                $cache = cache::make_from_params(cache_store::MODE_APPLICATION,
1010
                    'mod_bigbluebuttonbn',
1011
                    'presentationdefault_cache');
1012
                $pnoncekey = sha1(context_system::instance()->id);
1013
                /* The item id was adapted for granting public access to the presentation once in order
1014
                 * to allow BigBlueButton to gather the file. */
1015
                $pnoncevalue = bigbluebuttonbn_generate_nonce();
1016
                $cache->set($pnoncekey, array('value' => $pnoncevalue, 'counter' => 0));
1017
            }
1018
1019
            $url = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(),
1020
                $file->get_filearea(), $pnoncevalue, $file->get_filepath(), $file->get_filename());
@@ 1036-1045 (lines=10) @@
1033
    $file = reset($files);
1034
    unset($files);
1035
    $pnoncevalue = null;
1036
    if (!is_null($id)) {
1037
        // Create the nonce component for granting a temporary public access.
1038
        $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn',
1039
            'presentation_cache');
1040
        $pnoncekey = sha1($id);
1041
        /* The item id was adapted for granting public access to the presentation once in order
1042
         * to allow BigBlueButton to gather the file. */
1043
        $pnoncevalue = bigbluebuttonbn_generate_nonce();
1044
        $cache->set($pnoncekey, array('value' => $pnoncevalue, 'counter' => 0));
1045
    }
1046
    $url = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(),
1047
        $file->get_filearea(), $pnoncevalue, $file->get_filepath(), $file->get_filename());
1048
    return array('name' => $file->get_filename(), 'icon' => file_file_icon($file, 24),