RendererInterface.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Customer\Block\Address\Renderer;
  7. use Magento\Directory\Model\Country\Format;
  8. use Magento\Customer\Model\Address\AddressModelInterface;
  9. /**
  10. * Address renderer interface
  11. *
  12. * @author Magento Core Team <core@magentocommerce.com>
  13. */
  14. interface RendererInterface
  15. {
  16. /**
  17. * Set format type object
  18. *
  19. * @param \Magento\Framework\DataObject $type
  20. * @return void
  21. */
  22. public function setType(\Magento\Framework\DataObject $type);
  23. /**
  24. * Retrieve format type object
  25. *
  26. * @return \Magento\Framework\DataObject
  27. */
  28. public function getType();
  29. /**
  30. * Render address
  31. *
  32. * @param AddressModelInterface $address
  33. * @param string|null $format
  34. * @return mixed
  35. * All new code should use renderArray based on Metadata service
  36. */
  37. public function render(AddressModelInterface $address, $format = null);
  38. /**
  39. * Get a format object for a given address attributes, based on the type set earlier.
  40. *
  41. * @param null|array $addressAttributes
  42. * @return Format
  43. */
  44. public function getFormatArray($addressAttributes = null);
  45. /**
  46. * Render address by attribute array
  47. *
  48. * @param array $addressAttributes
  49. * @param Format|null $format
  50. * @return string
  51. */
  52. public function renderArray($addressAttributes, $format = null);
  53. }