Code Duplication    Length = 8-9 lines in 2 locations

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

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

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

@@ 56-64 (lines=9) @@
53
                Msg::add('Такой карты не существует', 'danger');
54
            }
55
56
            if (!Users\User::$cur->id) {
57
                $user_id = $this->Users->registration($_POST, true);
58
                if (!$user_id) {
59
                    $error = true;
60
                    $user = null;
61
                } else {
62
                    $user = Users\User::get($user_id);
63
                }
64
            }
65
            $userCard = \Ecommerce\Card\Item::get([['card_id', $card->id], ['user_id', $user->id]]);
66
            if ($userCard) {
67
                $error = true;