Code Duplication    Length = 9-10 lines in 2 locations

system/modules/Ecommerce/appControllers/CartController.php 1 location

@@ 22-31 (lines=10) @@
19
            $cart = Ecommerce\Cart::get($_SESSION['cart']['cart_id']);
20
            if (!empty($_POST)) {
21
                $error = false;
22
                if (!Users\User::$cur->id) {
23
                    $user_id = $this->Users->registration($_POST, true);
24
                    if (!$user_id) {
25
                        $error = true;
26
                    } else {
27
                        $user = Users\User::get($user_id);
28
                    }
29
                } else {
30
                    $user = Users\User::$cur;
31
                }
32
                $ids = [];
33
                if (!empty($_POST['cartItems'])) {
34
                    foreach ($_POST['cartItems'] as $cartItemId => $cartItemCont) {

system/modules/Ecommerce/appControllers/EcommerceController.php 1 location

@@ 27-35 (lines=9) @@
24
                Msg::add('Такой карты не существует', 'danger');
25
            }
26
27
            if (!Users\User::$cur->id) {
28
                $user_id = $this->Users->registration($_POST, true);
29
                if (!$user_id) {
30
                    $error = true;
31
                    $user = null;
32
                } else {
33
                    $user = Users\User::get($user_id);
34
                }
35
            }
36
            $userCard = \Ecommerce\Card\Item::get([['card_id', $card->id], ['user_id', $user->id]]);
37
            if ($userCard) {
38
                $error = true;