Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SetSensitiveCookie.php
Go to the documentation of this file.
1 <?php
7 
8 use \Magento\Framework\App\RequestInterface;
9 
13 {
19  public function execute()
20  {
21  $sensitiveCookieMetadata = $this->getCookieMetadataFactory()->createSensitiveCookieMetadata();
22 
23  $cookieDomain = $this->request->getParam('cookie_domain');
24  if ($cookieDomain !== null) {
25  $sensitiveCookieMetadata->setDomain($cookieDomain);
26  }
27  $cookiePath = $this->request->getParam('cookie_domain');
28  if ($cookiePath !== null) {
29  $sensitiveCookieMetadata->setPath($cookiePath);
30  }
31 
32  $cookieName = $this->request->getParam('cookie_name');
33  $cookieValue = $this->request->getParam('cookie_value');
34  $this->getCookieManager()->setSensitiveCookie($cookieName, $cookieValue, $sensitiveCookieMetadata);
35  return $this->_response;
36  }
37 }