CustomerLogout.php 887 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Wishlist\Observer;
  7. use Magento\Framework\Event\Observer;
  8. use Magento\Framework\Event\ObserverInterface;
  9. use Magento\Customer\Model\Session;
  10. /**
  11. * Class CustomerLogout
  12. * @package Magento\Wishlist\Observer
  13. */
  14. class CustomerLogout implements ObserverInterface
  15. {
  16. /**
  17. * @var \Magento\Customer\Model\Session
  18. */
  19. protected $customerSession;
  20. /**
  21. * @param Session $customerSession
  22. */
  23. public function __construct(Session $customerSession)
  24. {
  25. $this->customerSession = $customerSession;
  26. }
  27. /**
  28. * Customer logout processing
  29. *
  30. * @param Observer $observer
  31. * @return void
  32. */
  33. public function execute(Observer $observer)
  34. {
  35. $this->customerSession->setWishlistItemCount(0);
  36. }
  37. }