private function resolveCarts(
        CustomerInterface $customer,
        CartInterface $cartFromCustomer = null,
        CartInterface $cartFromSession = null
    ) {
        if ($cartFromCustomer) {
            return $cartFromCustomer;
        } else {
            if (!$cartFromSession) {

                /**
                 * Customer has no pending carts, and there is no cart in
                 * session.
                 *
                 * We create a new Cart
                 */
                $cart = $this
                    ->cartFactory
                    ->create();
            } else {

                /**
                 * Customer has no pending carts, and there is a cart loaded
                 * in session.
                 *
                 * If customer is not a pristine entity since it has already
                 * been flushed, we associate this cart with customer
                 */
                $cart = $cartFromSession;

                if ($customer->getId()) {
                    $cart->setCustomer($customer);
                    $customer->addCart($cart);
                }
            }

            return $cart;
        }
    }
private function resolveCarts(
        CustomerInterface $customer,
        CartInterface $cartFromCustomer = null,
        CartInterface $cartFromSession = null
    ) {
        if ($cartFromCustomer) {
            return $cartFromCustomer;
        } else {
            if (!$cartFromSession) {

                /**
                 * Customer has no pending carts, and there is no cart in
                 * session.
                 *
                 * We create a new Cart
                 */
                $cart = $this
                    ->cartFactory
                    ->create();
            } else {

                /**
                 * Customer has no pending carts, and there is a cart loaded
                 * in session.
                 *
                 * If customer is not a pristine entity since it has already
                 * been flushed, we associate this cart with customer
                 */
                $cart = $cartFromSession;

                if ($customer->getId()) {
                    $cart->setCustomer($customer);
                    $customer->addCart($cart);
                }
            }

            return $cart;
        }
    }
private function resolveCarts ( CustomerInterface $ customer , CartInterface $ cartFromCustomer = null , CartInterface $ cartFromSession = null ) { if ( $ cartFromCustomer ) { return $ cartFromCustomer ; } else { if ( ! $ cartFromSession ) { /**
                 * Customer has no pending carts, and there is no cart in
                 * session.
                 *
                 * We create a new Cart
                 */ $ cart = $ this -> cartFactory -> create ( ) ; } else { /**
                 * Customer has no pending carts, and there is a cart loaded
                 * in session.
                 *
                 * If customer is not a pristine entity since it has already
                 * been flushed, we associate this cart with customer
                 */ $ cart = $ cartFromSession ; if ( $ customer -> getId ( ) ) { $ cart -> setCustomer ( $ customer ) ; $ customer -> addCart ( $ cart ) ; } } return $ cart ; } }
Resolves a cart given a customer cart and a session cart.

@param CustomerInterface  $customer         Customer
@param CartInterface|null $cartFromCustomer Customer Cart
@param CartInterface|null $cartFromSession  Cart loaded from session

@return CartInterface Cart resolved
Resolves a cart given a customer cart and a session cart .