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