Code Duplication    Length = 11-11 lines in 2 locations

subscription.php 2 locations

@@ 393-403 (lines=11) @@
390
            $catCriteria->setOrder('ASC');
391
            $catObjs    = $helper->getHandler('Cat')->getAll($catCriteria);
392
            $selections = [];
393
            foreach ($catObjs as $cat_id => $catObj) {
394
                // create selections: $cat_id-$cat_selected-$old_catsubcr_id-$old_catsubscr_quited
395
                $selection      = [];
396
                $selection[0]   = $cat_id;
397
                $selection[1]   = in_array($cat_id, $_REQUEST['cats']) ? '1' : '0'; //isset($_REQUEST["cats_{$cat_id}"]);
398
                $selection[2]   = \Xmf\Request::getInt("existing_catsubcr_id_{$cat_id}", 0);
399
                $selection[3]   = \Xmf\Request::getInt("existing_catsubscr_quited_{$cat_id}", 0);
400
                $code_selection = implode('-', $selection);
401
                $selections[]   = $code_selection;
402
                unset($selection);
403
            }
404
            $code_selections = implode('|', $selections);
405
        }
406
@@ 430-440 (lines=11) @@
427
                $catCriteria->setOrder('ASC');
428
                $catObjs    = $helper->getHandler('Cat')->getAll($catCriteria);
429
                $selections = [];
430
                foreach ($catObjs as $cat_id => $catObj) {
431
                    // create selections: $cat_id-$cat_selected-$old_catsubcr_id-$old_catsubscr_quited
432
                    $selection      = [];
433
                    $selection[0]   = $cat_id;
434
                    $selection[1]   = in_array($cat_id, \Xmf\Request::getArray('cats')) ? '1' : '0'; //isset($_REQUEST["cats_{$cat_id}"]);
435
                    $selection[2]   = \Xmf\Request::getInt("existing_catsubcr_id_{$cat_id}", 0);
436
                    $selection[3]   = \Xmf\Request::getInt("existing_catsubscr_quited_{$cat_id}", 0);
437
                    $code_selection = implode('-', $selection);
438
                    $selections[]   = $code_selection;
439
                    unset($selection);
440
                }
441
                $code_selections = implode('|', $selections); // string
442
                //
443
                // get or create subscr