Dispatch cartLine event when is removed.

@param CartInterface     $cart     Cart
@param CartLineInterface $cartLine CartLine

@return $this Self object
517654
public function dispatchCartLineOnRemoveEvent(
        CartInterface $cart,
        CartLineInterface $cartLine
    ) {
        $this->eventDispatcher->dispatch(
            ElcodiCartEvents::CARTLINE_ONREMOVE,
            new CartLineOnAddEvent(
                $cart,
                $cartLine
            )
        );

        return $this;
    }
147269
public function loadCartShippingAmount(CartInterface $cart)
    {
        $shippingMethodId = $cart->getShippingMethod();

        if (empty($shippingMethodId)) {
            return;
        }

        $shippingMethod = $this
            ->shippingWrapper
            ->getOneById($cart, $shippingMethodId);

        if ($shippingMethod instanceof ShippingMethod) {
            $cart->setShippingAmount(
                $shippingMethod->getPrice()
            );
        }
    }
869222
public function carteira($carteira)
    {
        $reflection = new ReflectionClass($this->namespace . '\\Carteira\\Carteira' . $carteira);
        $this->carteira = $reflection->newInstanceArgs();

        return $this;
    }
1182532
public function emptyCart()
    {
        unset($this->cart->items);

        $this->update();

        $this->events->dispatch('laracart.empty', $this->cart->instance);
    }
6417
public function detach($priority)
    {
        if ($this->started) {
            throw new RuntimeException('Unable during invoking.');
        }
        if (isset($this->queue[$priority])) {
            unset($this->queue[$priority]);
            $this->sortedQueue = null;
        }

        return $this;
    }
460337
public function removeCoupon(
        CartInterface $cart,
        CouponInterface $coupon
    ) {
        $cartCoupons = $this
            ->cartCouponDirector
            ->findBy([
                'cart' => $cart,
                'coupon' => $coupon,
            ]);

        if (empty($cartCoupons)) {
            return false;
        }

        foreach ($cartCoupons as $cartCoupon) {
            $this
                ->cartCouponEventDispatcher
                ->dispatchCartCouponOnRemoveEvent(
                    $cartCoupon
                );
        }

        return true;
    }
612518
public function getSessionCart(EventDispatcherInterface $dispatcher = null)
    {
        $cart_id = $this->get("thelia.cart_id", null);
        if (null !== $cart_id) {
            $cart = CartQuery::create()->findPk($cart_id);
        } else {
            $cart = self::$transientCart;
        }

        // If we do not have a cart, or if the current cart is nor valid
        // restore it from the cart cookie, or create a new one
        if (null === $cart || ! $this->isValidCart($cart)) {
            // A dispatcher is required here. If we do not have it, throw an exception
            // This is a temporary workaround to ensure backward compatibility with getCart(),
            // When genCart() will be removed, this check should be removed, and  $dispatcher should become
            // a required parameter.

            if (null == $dispatcher) {
                throw new \InvalidArgumentException(
                    "In this context (no cart in session), an EventDispatcher should be provided to Session::getSessionCart()."
                );
            }

            $cartEvent = new CartRestoreEvent();

            if (null !== $cart) {
                $cartEvent->setCart($cart);
            }

            $dispatcher->dispatch(TheliaEvents::CART_RESTORE_CURRENT, $cartEvent);

            if (null === $cart = $cartEvent->getCart()) {
                throw new \LogicException(
                    "Unable to get a Cart."
                );
            }

            // Store the cart.
            $this->setSessionCart($cart);
        }

        return $cart;
    }
1043751
public function silentRemoveLine(
        CartInterface $cart,
        CartLineInterface $cartLine
    ) {
        $cart->removeCartLine($cartLine);

        $this
            ->cartLineEventDispatcher
            ->dispatchCartLineOnRemoveEvent(
                $cart,
                $cartLine
            );

        return $this;
    }
1275990
public function dispatchCartCouponOnRemoveEvent(
        CartCouponInterface $cartCoupon
    ) {
        $cart = $cartCoupon->getCart();
        $coupon = $cartCoupon->getCoupon();

        $event = new CartCouponOnRemoveEvent($cart, $coupon);
        $event->setCartCoupon($cartCoupon);
        $this->eventDispatcher->dispatch(
            ElcodiCartCouponEvents::CART_COUPON_ONREMOVE,
            $event
        );
    }
506478
public function loadCartTotalAmount(CartInterface $cart)
    {
        $currency = $this
            ->currencyWrapper
            ->get();

        $finalAmount = clone $cart->getPurchasableAmount();

        /**
         * Calculates the shipping amount.
         */
        $shippingAmount = $cart->getShippingAmount();
        if ($shippingAmount instanceof MoneyInterface) {
            $convertedShippingAmount = $this
                ->currencyConverter
                ->convertMoney(
                    $shippingAmount,
                    $currency
                );
            $finalAmount = $finalAmount->add($convertedShippingAmount);
        }

        /**
         * Calculates the coupon amount.
         */
        $couponAmount = $cart->getCouponAmount();
        if ($couponAmount instanceof MoneyInterface) {
            $convertedCouponAmount = $this
                ->currencyConverter
                ->convertMoney(
                    $couponAmount,
                    $currency
                );
            $finalAmount = $finalAmount->subtract($convertedCouponAmount);
        }

        $cart->setAmount($finalAmount);
    }
15045
public function deleteRule($pIndex)
    {
        if (isset($this->ruleset[$pIndex])) {
            unset($this->ruleset[$pIndex]);
            //    If we've just deleted down to a single rule, then reset And/Or joining to Or
            if (count($this->ruleset) <= 1) {
                $this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR);
            }
        }

        return $this;
    }
1249088
public function removeCouponByCode(
        CartInterface $cart,
        $couponCode
    ) {
        $coupon = $this
            ->couponRepository
            ->findOneBy([
                'code' => $couponCode,
            ]);

        if (!($coupon instanceof CouponInterface)) {
            return false;
        }

        return $this
            ->removeCoupon(
                $cart,
                $coupon
            );
    }
739481
public function remove()
    {
        $key = $this->request->param('ID');
        $title = "";

        if (!empty($key)) {
            foreach ($this->items as $item) {
                if ($item->Key == $key) {
                    $title = $item->Title;
                    $this->items->remove($item);
                }
            }

            $this->save();
            
            if ($title) {
                $this->setSessionMessage(
                    "bad",
                    _t(
                        "Checkout.RemovedItem",
                        "Removed '{title}' from your cart",
                        "Message to tell user they removed an item",
                        array("title" => $title)
                    )
                );
            }
        }

        return $this->redirectBack();
    }
801149
public function dispatchOrderLineOnCreatedEvent(
        OrderInterface $order,
        CartLineInterface $cartLine,
        OrderLineInterface $orderLine
    ) {
        $orderLineOnCreatedEvent = new OrderLineOnCreatedEvent(
            $order,
            $cartLine,
            $orderLine
        );

        $this->eventDispatcher->dispatch(
            ElcodiCartEvents::ORDERLINE_ONCREATED,
            $orderLineOnCreatedEvent
        );

        return $this;
    }
347516
public function dispatchOrderCouponOnApplyEvent(
        OrderInterface $cart,
        CouponInterface $coupon
    ) {
        $event = new OrderCouponOnApplyEvent(
            $cart,
            $coupon
        );

        $this->eventDispatcher->dispatch(
            ElcodiCartCouponEvents::ORDER_COUPON_ONAPPLY,
            $event
        );
    }
953865
public function validateEmptyShippingAmount(CartInterface $cart)
    {
        $shippingAmount = $cart->getShippingAmount();
        if (!($shippingAmount instanceof MoneyInterface)) {
            $cart
                ->setShippingAmount(
                    $this
                        ->emptyMoneyWrapper
                        ->get()
                );
        }
    }
644324
public function setSessionCart(Cart $cart = null)
    {
        if (null === $cart || $cart->isNew()) {
            self::$transientCart = $cart;
            $this->remove("thelia.cart_id");
        } else {
            self::$transientCart = null;
            $this->set("thelia.cart_id", $cart->getId());
        }

        return $this;
    }