Code Duplication    Length = 21-21 lines in 2 locations

main/inc/lib/urlmanager.lib.php 2 locations

@@ 521-541 (lines=21) @@
518
     * @param  array $urlList of url_ids
519
     * @return array
520
     **/
521
    public static function addUserGroupListToUrl($userGroupList, $urlList)
522
    {
523
        $resultArray = array();
524
        if (is_array($userGroupList) && is_array($urlList)) {
525
            foreach ($urlList as $urlId) {
526
                foreach ($userGroupList as $userGroupId) {
527
                    $count = self::relationUrlUsergroupExist($userGroupId, $urlId);
528
                    if ($count == 0) {
529
                        $result = self::addUserGroupToUrl($userGroupId, $urlId);
530
                        if ($result) {
531
                            $resultArray[$urlId][$userGroupId] = 1;
532
                        } else {
533
                            $resultArray[$urlId][$userGroupId] = 0;
534
                        }
535
                    }
536
                }
537
            }
538
        }
539
540
        return 	$resultArray;
541
    }
542
543
    /**
544
     * Add a group of user group into a group of URLs
@@ 550-570 (lines=21) @@
547
     * @param  array of url_ids
548
     * @return array
549
     **/
550
    public static function addCourseCategoryListToUrl($courseCategoryList, $urlList)
551
    {
552
        $resultArray = array();
553
        if (is_array($courseCategoryList) && is_array($urlList)) {
554
            foreach ($urlList as $urlId) {
555
                foreach ($courseCategoryList as $categoryCourseId) {
556
                    $count = self::relationUrlCourseCategoryExist($categoryCourseId, $urlId);
557
                    if ($count == 0) {
558
                        $result = self::addCourseCategoryToUrl($categoryCourseId, $urlId);
559
                        if ($result) {
560
                            $resultArray[$urlId][$categoryCourseId] = 1;
561
                        } else {
562
                            $resultArray[$urlId][$categoryCourseId] = 0;
563
                        }
564
                    }
565
                }
566
            }
567
        }
568
569
        return 	$resultArray;
570
    }
571
572
    /**
573
     * Checks the relationship between an URL and a UserGr