RecentlyComparedStorageConfiguration.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Catalog\Model\Widget;
  7. use Magento\Catalog\Model\FrontendStorageConfigurationInterface;
  8. use Magento\Framework\App\Config\ScopeConfigInterface;
  9. /**
  10. * Configurate all storages that needed for recently viewed widgets
  11. */
  12. class RecentlyComparedStorageConfiguration implements FrontendStorageConfigurationInterface
  13. {
  14. /** Recently Viewed lifetime */
  15. const XML_LIFETIME_PATH = "catalog/recently_products/recently_compared_lifetime";
  16. /**
  17. * @var ScopeConfigInterface
  18. */
  19. private $scopeConfig;
  20. /**
  21. * RecentlyViewedStorageConfiguration constructor.
  22. * @param ScopeConfigInterface $scopeConfig
  23. */
  24. public function __construct(ScopeConfigInterface $scopeConfig)
  25. {
  26. $this->scopeConfig = $scopeConfig;
  27. }
  28. /**
  29. * Parse lifetime of recently compared products in widget
  30. *
  31. * @inheritdoc
  32. */
  33. public function get()
  34. {
  35. return [
  36. 'lifetime' => $this->scopeConfig->getValue(self::XML_LIFETIME_PATH)
  37. ];
  38. }
  39. }