/** * Remove the given cart item from the given cart. * * @param CartInterface $cart * @param ItemInterface $item * * @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException */ private function doDeleteItem(CartInterface $cart, ItemInterface $item) { if (!$this->cartManager->removeItem($cart, $item)) { throw new BadRequestHttpException(); } $this->dispatcher->dispatch(LeaphlyCartEvents::ITEM_DELETE_COMPLETED, $this->eventFactory->getEvent($cart, $item)); }