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
7 
9 {
15  protected $persistentData;
16 
22  protected $customerSession;
23 
29  protected $persistentSession;
30 
38  public function __construct(
39  \Magento\Persistent\Helper\Data $persistentData,
40  \Magento\Customer\Model\Session $customerSession,
41  \Magento\Persistent\Helper\Session $persistentSession
42  ) {
43  $this->persistentData = $persistentData;
44  $this->customerSession = $customerSession;
45  $this->persistentSession = $persistentSession;
46  }
47 
57  public function aroundGetSectionData(
58  \Magento\Customer\CustomerData\Customer $subject,
59  \Closure $proceed
60  ) {
62  if (!$this->customerSession->isLoggedIn()
63  && $this->persistentData->isEnabled()
64  && $this->persistentSession->isPersistent()
65  ) {
66  return [];
67  }
68  return $proceed();
69  }
70 }
__construct(\Magento\Persistent\Helper\Data $persistentData, \Magento\Customer\Model\Session $customerSession, \Magento\Persistent\Helper\Session $persistentSession)
aroundGetSectionData(\Magento\Customer\CustomerData\Customer $subject, \Closure $proceed)