UnsetAllObserver.php 860 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Checkout\Observer;
  7. use Magento\Framework\Event\ObserverInterface;
  8. class UnsetAllObserver implements ObserverInterface
  9. {
  10. /**
  11. * @var \Magento\Checkout\Model\Session
  12. */
  13. protected $checkoutSession;
  14. /**
  15. * @param \Magento\Checkout\Model\Session $checkoutSession
  16. * @codeCoverageIgnore
  17. */
  18. public function __construct(\Magento\Checkout\Model\Session $checkoutSession)
  19. {
  20. $this->checkoutSession = $checkoutSession;
  21. }
  22. /**
  23. * @param \Magento\Framework\Event\Observer $observer
  24. * @return void
  25. * @codeCoverageIgnore
  26. */
  27. public function execute(\Magento\Framework\Event\Observer $observer)
  28. {
  29. $this->checkoutSession->clearQuote()->clearStorage();
  30. }
  31. }