Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CustomerData.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Customer\Block;
7 
13 {
17  private $expirableSectionNames;
18 
24  public function __construct(
25  \Magento\Framework\View\Element\Template\Context $context,
26  array $data = [],
27  array $expirableSectionNames = []
28  ) {
29  parent::__construct($context, $data);
30  $this->expirableSectionNames = $expirableSectionNames;
31  }
32 
37  public function getCookieLifeTime()
38  {
39  return $this->_scopeConfig->getValue(
40  \Magento\Framework\Session\Config::XML_PATH_COOKIE_LIFETIME,
41  \Magento\Store\Model\ScopeInterface::SCOPE_STORE
42  );
43  }
44 
51  public function getCustomerDataUrl($route)
52  {
53  return $this->getUrl($route, ['_secure' => $this->getRequest()->isSecure()]);
54  }
55 
64  public function getExpirableSectionLifetime()
65  {
66  return (int)$this->_scopeConfig->getValue('customer/online_customers/section_data_lifetime');
67  }
68 
75  public function getExpirableSectionNames()
76  {
77  return array_values($this->expirableSectionNames);
78  }
79 }
__construct(\Magento\Framework\View\Element\Template\Context $context, array $data=[], array $expirableSectionNames=[])