AddressToComponentsString.php 703 B

12345678910111213141516171819202122232425262728
  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\InventoryDistanceBasedSourceSelection\Model\Convert;
  8. use Magento\InventorySourceSelectionApi\Api\Data\AddressInterface;
  9. class AddressToComponentsString
  10. {
  11. /**
  12. * Get components string from address
  13. *
  14. * @param AddressInterface $address
  15. * @return string
  16. */
  17. public function execute(AddressInterface $address): string
  18. {
  19. return implode('|', [
  20. 'country:' . $address->getCountry(),
  21. // 'postal_code:' . $address->getPostcode(),
  22. 'locality:' . $address->getCity(),
  23. ]);
  24. }
  25. }