Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
VarnishPlugin.php
Go to the documentation of this file.
1 <?php
7 
14 
19 {
23  private $config;
24 
28  private $version;
29 
33  private $state;
34 
38  private $registry;
39 
46  public function __construct(Config $config, Version $version, AppState $state, Registry $registry)
47  {
48  $this->config = $config;
49  $this->version = $version;
50  $this->state = $state;
51  $this->registry = $registry;
52  }
53 
65  {
66  $usePlugin = $this->registry->registry('use_page_cache_plugin');
67 
68  if ($this->config->getType() == Config::VARNISH && $this->config->isEnabled() && $usePlugin) {
69  $this->version->process();
70 
71  if ($this->state->getMode() == AppState::MODE_DEVELOPER) {
72  $response->setHeader('X-Magento-Debug', 1);
73  }
74  }
75 
76  return $result;
77  }
78 }
$response
Definition: 404.php:11
$config
Definition: fraud_order.php:17
__construct(Config $config, Version $version, AppState $state, Registry $registry)
afterRenderResult(ResultInterface $subject, ResultInterface $result, ResponseHttp $response)