CustomerAddressesFormatter.php 828 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\InstantPurchase\Model\Ui;
  7. use Magento\Customer\Model\Address;
  8. /**
  9. * Address string presentation.
  10. *
  11. * @api May be used for pluginization.
  12. * @since 100.2.0
  13. */
  14. class CustomerAddressesFormatter
  15. {
  16. /**
  17. * Formats address to simple string.
  18. *
  19. * @param Address $address
  20. * @return string
  21. * @since 100.2.0
  22. */
  23. public function format(Address $address): string
  24. {
  25. return sprintf(
  26. '%s, %s, %s, %s %s, %s',
  27. $address->getName(),
  28. $address->getStreetFull(),
  29. $address->getCity(),
  30. $address->getRegion(),
  31. $address->getPostcode(),
  32. $address->getCountryModel()->getName()
  33. );
  34. }
  35. }