12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Persistent\Model\Plugin;
- class CustomerData
- {
- /**
- * Persistent data
- *
- * @var \Magento\Persistent\Helper\Data
- */
- protected $persistentData;
- /**
- * Customer session
- *
- * @var \Magento\Customer\Model\Session
- */
- protected $customerSession;
- /**
- * Persistent session
- *
- * @var \Magento\Persistent\Helper\Session
- */
- protected $persistentSession;
- /**
- * CustomerData constructor.
- *
- * @param \Magento\Persistent\Helper\Data $persistentData
- * @param \Magento\Customer\Model\Session $customerSession
- * @param \Magento\Persistent\Helper\Session $persistentSession
- */
- public function __construct(
- \Magento\Persistent\Helper\Data $persistentData,
- \Magento\Customer\Model\Session $customerSession,
- \Magento\Persistent\Helper\Session $persistentSession
- ) {
- $this->persistentData = $persistentData;
- $this->customerSession = $customerSession;
- $this->persistentSession = $persistentSession;
- }
- /**
- * Reset quote reward point amount
- *
- * @param \Magento\Customer\CustomerData\Customer $subject
- * @param \Closure $proceed
- *
- * @return array
- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
- */
- public function aroundGetSectionData(
- \Magento\Customer\CustomerData\Customer $subject,
- \Closure $proceed
- ) {
- /** unset customer first name */
- if (!$this->customerSession->isLoggedIn()
- && $this->persistentData->isEnabled()
- && $this->persistentSession->isPersistent()
- ) {
- return [];
- }
- return $proceed();
- }
- }
|