Code Duplication    Length = 17-17 lines in 2 locations

main/inc/lib/AnnouncementManager.php 2 locations

@@ 541-557 (lines=17) @@
538
                // Storing the selected groups
539
                if (is_array($send_to['groups']) && !empty($send_to['groups'])) {
540
                    $counter = 1;
541
                    foreach ($send_to['groups'] as $group) {
542
                        $groupInfo = GroupManager::get_group_properties($group);
543
                        api_item_property_update(
544
                            $courseInfo,
545
                            TOOL_ANNOUNCEMENT,
546
                            $last_id,
547
                            'AnnouncementAdded',
548
                            $authorId,
549
                            $groupInfo
550
                        );
551
552
                        if (($counter % $batchSize) === 0) {
553
                             $em->flush();
554
                             $em->clear();
555
                        }
556
                        $counter++;
557
                    }
558
                }
559
560
                // Storing the selected users
@@ 563-579 (lines=17) @@
560
                // Storing the selected users
561
                if (is_array($send_to['users'])) {
562
                    $counter = 1;
563
                    foreach ($send_to['users'] as $user) {
564
                        api_item_property_update(
565
                            $courseInfo,
566
                            TOOL_ANNOUNCEMENT,
567
                            $last_id,
568
                            'AnnouncementAdded',
569
                            $authorId,
570
                            '',
571
                            $user
572
                        );
573
574
                        if (($counter % $batchSize) === 0) {
575
                             $em->flush();
576
                             $em->clear();
577
                        }
578
                        $counter++;
579
                    }
580
                }
581
            }
582