CmsPageConfigReader.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sitemap\Model\ItemProvider;
  7. use Magento\Framework\App\Config\ScopeConfigInterface;
  8. use Magento\Store\Model\ScopeInterface;
  9. class CmsPageConfigReader implements ConfigReaderInterface
  10. {
  11. /**#@+
  12. * Xpath config settings
  13. */
  14. const XML_PATH_CHANGE_FREQUENCY = 'sitemap/page/changefreq';
  15. const XML_PATH_PRIORITY = 'sitemap/page/priority';
  16. /**#@-*/
  17. /**
  18. * Scope config
  19. *
  20. * @var ScopeConfigInterface
  21. */
  22. private $scopeConfig;
  23. /**
  24. * CategoryItemResolverConfigReader constructor.
  25. *
  26. * @param ScopeConfigInterface $scopeConfig
  27. */
  28. public function __construct(ScopeConfigInterface $scopeConfig)
  29. {
  30. $this->scopeConfig = $scopeConfig;
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function getPriority($storeId)
  36. {
  37. return (string)$this->scopeConfig->getValue(
  38. self::XML_PATH_PRIORITY,
  39. ScopeInterface::SCOPE_STORE,
  40. $storeId
  41. );
  42. }
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function getChangeFrequency($storeId)
  47. {
  48. return (string)$this->scopeConfig->getValue(
  49. self::XML_PATH_CHANGE_FREQUENCY,
  50. ScopeInterface::SCOPE_STORE,
  51. $storeId
  52. );
  53. }
  54. }