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 
15 
20 {
24  private $config;
25 
29  private $version;
30 
34  private $state;
35 
41  public function __construct(Config $config, Version $version, AppState $state)
42  {
43  $this->config = $config;
44  $this->version = $version;
45  $this->state = $state;
46  }
47 
57  public function afterDispatch(FrontControllerInterface $subject, $result)
58  {
59  if ($this->config->getType() == Config::VARNISH && $this->config->isEnabled()
60  && $result instanceof ResponseHttp
61  ) {
62  $this->version->process();
63 
64  if ($this->state->getMode() == AppState::MODE_DEVELOPER) {
65  $result->setHeader('X-Magento-Debug', 1);
66  }
67  }
68 
69  return $result;
70  }
71 }
$config
Definition: fraud_order.php:17
afterDispatch(FrontControllerInterface $subject, $result)
__construct(Config $config, Version $version, AppState $state)