Code Duplication    Length = 21-21 lines in 2 locations

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

@@ 540-560 (lines=21) @@
537
     * @param  array $urlList of url_ids
538
     * @return array
539
     **/
540
    public static function addUserGroupListToUrl($userGroupList, $urlList)
541
    {
542
        $resultArray = array();
543
        if (is_array($userGroupList) && is_array($urlList)) {
544
            foreach ($urlList as $urlId) {
545
                foreach ($userGroupList as $userGroupId) {
546
                    $count = self::relationUrlUsergroupExist($userGroupId, $urlId);
547
                    if ($count == 0) {
548
                        $result = self::addUserGroupToUrl($userGroupId, $urlId);
549
                        if ($result) {
550
                            $resultArray[$urlId][$userGroupId] = 1;
551
                        } else {
552
                            $resultArray[$urlId][$userGroupId] = 0;
553
                        }
554
                    }
555
                }
556
            }
557
        }
558
559
        return 	$resultArray;
560
    }
561
562
    /**
563
     * Add a group of user group into a group of URLs
@@ 569-589 (lines=21) @@
566
     * @param  array of url_ids
567
     * @return array
568
     **/
569
    public static function addCourseCategoryListToUrl($courseCategoryList, $urlList)
570
    {
571
        $resultArray = array();
572
        if (is_array($courseCategoryList) && is_array($urlList)) {
573
            foreach ($urlList as $urlId) {
574
                foreach ($courseCategoryList as $categoryCourseId) {
575
                    $count = self::relationUrlCourseCategoryExist($categoryCourseId, $urlId);
576
                    if ($count == 0) {
577
                        $result = self::addCourseCategoryToUrl($categoryCourseId, $urlId);
578
                        if ($result) {
579
                            $resultArray[$urlId][$categoryCourseId] = 1;
580
                        } else {
581
                            $resultArray[$urlId][$categoryCourseId] = 0;
582
                        }
583
                    }
584
                }
585
            }
586
        }
587
588
        return 	$resultArray;
589
    }
590
591
    /**
592
     * Checks the relationship between an URL and a UserGr