12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Customer\CustomerData;
- use Magento\Customer\Helper\Session\CurrentCustomer;
- use Magento\Customer\Helper\View;
- /**
- * Customer section
- */
- class Customer implements SectionSourceInterface
- {
- /**
- * @var CurrentCustomer
- */
- protected $currentCustomer;
- /**
- * @var View
- */
- private $customerViewHelper;
- /**
- * @param CurrentCustomer $currentCustomer
- * @param View $customerViewHelper
- */
- public function __construct(
- CurrentCustomer $currentCustomer,
- View $customerViewHelper
- ) {
- $this->currentCustomer = $currentCustomer;
- $this->customerViewHelper = $customerViewHelper;
- }
- /**
- * {@inheritdoc}
- */
- public function getSectionData()
- {
- if (!$this->currentCustomer->getCustomerId()) {
- return [];
- }
- $customer = $this->currentCustomer->getCustomer();
- return [
- 'fullname' => $this->customerViewHelper->getCustomerName($customer),
- 'firstname' => $customer->getFirstname(),
- 'websiteId' => $customer->getWebsiteId(),
- ];
- }
- }
|