Code Duplication    Length = 17-18 lines in 2 locations

main/newscorm/learnpath.class.php 2 locations

@@ 5884-5901 (lines=18) @@
5881
        $creatorId = empty($creatorId) ? api_get_user_id() : $creatorId;
5882
5883
        $folder = false;
5884
        if (!is_dir($filepath.'/'.$dir)) {
5885
            $folderData = create_unexisting_directory(
5886
                $course,
5887
                $creatorId,
5888
                api_get_session_id(),
5889
                0,
5890
                0,
5891
                $filepath,
5892
                $dir,
5893
                get_lang('LearningPaths'),
5894
                0
5895
            );
5896
            if (!empty($folderData)) {
5897
                $folder = true;
5898
            }
5899
        } else {
5900
            $folder = true;
5901
        }
5902
5903
        return $folder;
5904
    }
@@ 5930-5946 (lines=17) @@
5927
            $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80);
5928
            $dir   = $dir.$title;
5929
            $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document';
5930
            if (!is_dir($filepath.'/'.$dir)) {
5931
                $folderData = create_unexisting_directory(
5932
                    $course,
5933
                    api_get_user_id(),
5934
                    0,
5935
                    0,
5936
                    0,
5937
                    $filepath,
5938
                    $dir,
5939
                    $lp_name
5940
                );
5941
                if (!empty($folderData)) {
5942
                    $folder = true;
5943
                }
5944
            } else {
5945
                $folder = true;
5946
            }
5947
            $dir = $dir.'/';
5948
            if ($folder) {
5949
                $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir;