SearchTermsLog.php 945 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\CatalogSearch\Block;
  7. use Magento\Framework\App\ResponseInterface;
  8. use Magento\Framework\View\Element\Block\ArgumentInterface;
  9. /**
  10. * Provider of the information on whether the page is cacheable, so that AJAX-based logging of terms can be triggered
  11. */
  12. class SearchTermsLog implements ArgumentInterface
  13. {
  14. /**
  15. * @var \Magento\Framework\App\ResponseInterface
  16. */
  17. private $response;
  18. /**
  19. * @param ResponseInterface $response
  20. */
  21. public function __construct(
  22. ResponseInterface $response
  23. ) {
  24. $this->response = $response;
  25. }
  26. /**
  27. * Check is current page cacheable
  28. *
  29. * @return bool
  30. */
  31. public function isPageCacheable()
  32. {
  33. $pragma = $this->response->getHeader('pragma')->getFieldValue();
  34. return ($pragma == 'cache');
  35. }
  36. }