AccountDelegation.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\Customer\Model\Delegation;
  8. use Magento\Customer\Api\Data\CustomerInterface;
  9. use Magento\Customer\Api\AccountDelegationInterface;
  10. use Magento\Framework\Controller\Result\Redirect;
  11. use Magento\Framework\Controller\Result\RedirectFactory;
  12. /**
  13. * {@inheritdoc}
  14. */
  15. class AccountDelegation implements AccountDelegationInterface
  16. {
  17. /**
  18. * @var RedirectFactory
  19. */
  20. private $redirectFactory;
  21. /**
  22. * @var Storage
  23. */
  24. private $storage;
  25. /**
  26. * @param RedirectFactory $redirectFactory
  27. * @param Storage $storage
  28. */
  29. public function __construct(
  30. RedirectFactory $redirectFactory,
  31. Storage $storage
  32. ) {
  33. $this->redirectFactory = $redirectFactory;
  34. $this->storage = $storage;
  35. }
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public function createRedirectForNew(
  40. CustomerInterface $customer,
  41. array $mixedData = null
  42. ): Redirect {
  43. $this->storage->storeNewOperation($customer, $mixedData);
  44. return $this->redirectFactory->create()->setPath('customer/account/create');
  45. }
  46. }