Code Duplication    Length = 11-11 lines in 3 locations

subscription.php 3 locations

@@ 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
@@ 492-502 (lines=11) @@
489
            $catCriteria->setOrder('ASC');
490
            $catObjs    = $helper->getHandler('Cat')->getAll($catCriteria);
491
            $selections = [];
492
            foreach ($catObjs as $cat_id => $catObj) {
493
                // create selections: $cat_id-$cat_selected-$old_catsubcr_id-$old_catsubscr_quited
494
                $selection      = [];
495
                $selection[0]   = $cat_id;
496
                $selection[1]   = in_array($cat_id, $_REQUEST['cats']) ? '1' : '0'; //isset($_REQUEST["cats_{$cat_id}"]);
497
                $selection[2]   = Request::getInt("existing_catsubcr_id_{$cat_id}", 0);
498
                $selection[3]   = Request::getInt("existing_catsubscr_quited_{$cat_id}", 0);
499
                $code_selection = implode('-', $selection);
500
                $selections[]   = $code_selection;
501
                unset($selection);
502
            }
503
            $code_selections = implode('|', $selections);
504
        }
505
@@ 529-539 (lines=11) @@
526
                $catCriteria->setOrder('ASC');
527
                $catObjs    = $helper->getHandler('Cat')->getAll($catCriteria);
528
                $selections = [];
529
                foreach ($catObjs as $cat_id => $catObj) {
530
                    // create selections: $cat_id-$cat_selected-$old_catsubcr_id-$old_catsubscr_quited
531
                    $selection      = [];
532
                    $selection[0]   = $cat_id;
533
                    $selection[1]   = in_array($cat_id, Request::getArray('cats')) ? '1' : '0'; //isset($_REQUEST["cats_{$cat_id}"]);
534
                    $selection[2]   = Request::getInt("existing_catsubcr_id_{$cat_id}", 0);
535
                    $selection[3]   = Request::getInt("existing_catsubscr_quited_{$cat_id}", 0);
536
                    $code_selection = implode('-', $selection);
537
                    $selections[]   = $code_selection;
538
                    unset($selection);
539
                }
540
                $code_selections = implode('|', $selections); // string
541
                //
542
                // get or create subscr