Code Duplication    Length = 11-11 lines in 3 locations

subscription.php 3 locations

@@ 491-501 (lines=11) @@
488
            $catCriteria->setOrder('ASC');
489
            $catObjs    = $helper->getHandler('Cat')->getAll($catCriteria);
490
            $selections = [];
491
            foreach ($catObjs as $cat_id => $catObj) {
492
                // create selections: $cat_id-$cat_selected-$old_catsubcr_id-$old_catsubscr_quited
493
                $selection      = [];
494
                $selection[0]   = $cat_id;
495
                $selection[1]   = in_array($cat_id, $_REQUEST['cats']) ? '1' : '0'; //isset($_REQUEST["cats_{$cat_id}"]);
496
                $selection[2]   = Request::getInt("existing_catsubcr_id_{$cat_id}", 0);
497
                $selection[3]   = Request::getInt("existing_catsubscr_quited_{$cat_id}", 0);
498
                $code_selection = implode('-', $selection);
499
                $selections[]   = $code_selection;
500
                unset($selection);
501
            }
502
            $code_selections = implode('|', $selections);
503
        }
504
@@ 528-538 (lines=11) @@
525
                $catCriteria->setOrder('ASC');
526
                $catObjs    = $helper->getHandler('Cat')->getAll($catCriteria);
527
                $selections = [];
528
                foreach ($catObjs as $cat_id => $catObj) {
529
                    // create selections: $cat_id-$cat_selected-$old_catsubcr_id-$old_catsubscr_quited
530
                    $selection      = [];
531
                    $selection[0]   = $cat_id;
532
                    $selection[1]   = in_array($cat_id, Request::getArray('cats')) ? '1' : '0'; //isset($_REQUEST["cats_{$cat_id}"]);
533
                    $selection[2]   = Request::getInt("existing_catsubcr_id_{$cat_id}", 0);
534
                    $selection[3]   = Request::getInt("existing_catsubscr_quited_{$cat_id}", 0);
535
                    $code_selection = implode('-', $selection);
536
                    $selections[]   = $code_selection;
537
                    unset($selection);
538
                }
539
                $code_selections = implode('|', $selections); // string
540
                //
541
                // get or create subscr
@@ 675-685 (lines=11) @@
672
                    $catCriteria->setOrder('ASC');
673
                    $catObjs    = $helper->getHandler('Cat')->getAll($catCriteria);
674
                    $selections = [];
675
                    foreach ($catObjs as $cat_id => $catObj) {
676
                        // create selections: $cat_id-$cat_selected-$old_catsubcr_id-$old_catsubscr_quited
677
                        $selection      = [];
678
                        $selection[0]   = $cat_id;
679
                        $selection[1]   = in_array($cat_id, Request::getArray('cats')) ? '1' : '0'; //isset($_REQUEST["cats_{$cat_id}"]);
680
                        $selection[2]   = Request::getInt("existing_catsubcr_id_{$cat_id}", 0);
681
                        $selection[3]   = Request::getInt("existing_catsubscr_quited_{$cat_id}", 0);
682
                        $code_selection = implode('-', $selection);
683
                        $selections[]   = $code_selection;
684
                        unset($selection);
685
                    }
686
                    $code_selections = implode('|', $selections); // string
687
                } else {
688
                    // get subscr fields from subscr_actoptions