PriceCurrencyInterface.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Pricing;
  7. /**
  8. * Interface PriceCurrencyInterface
  9. *
  10. * @api
  11. * @since 100.0.2
  12. */
  13. interface PriceCurrencyInterface
  14. {
  15. /**
  16. * Default precision
  17. */
  18. const DEFAULT_PRECISION = 2;
  19. /**
  20. * Convert price value
  21. *
  22. * @param float $amount
  23. * @param null|string|bool|int|\Magento\Framework\App\ScopeInterface $scope
  24. * @param \Magento\Framework\Model\AbstractModel|string|null $currency
  25. * @return float
  26. */
  27. public function convert($amount, $scope = null, $currency = null);
  28. /**
  29. * Convert and round price value
  30. *
  31. * @param float $amount
  32. * @param null|string|bool|int|\Magento\Framework\App\ScopeInterface $scope
  33. * @param \Magento\Framework\Model\AbstractModel|string|null $currency
  34. * @param int $precision
  35. * @return float
  36. */
  37. public function convertAndRound($amount, $scope = null, $currency = null, $precision = self::DEFAULT_PRECISION);
  38. /**
  39. * Format price value
  40. *
  41. * @param float $amount
  42. * @param bool $includeContainer
  43. * @param int $precision
  44. * @param null|string|bool|int|\Magento\Framework\App\ScopeInterface $scope
  45. * @param \Magento\Framework\Model\AbstractModel|string|null $currency
  46. * @return float
  47. */
  48. public function format(
  49. $amount,
  50. $includeContainer = true,
  51. $precision = self::DEFAULT_PRECISION,
  52. $scope = null,
  53. $currency = null
  54. );
  55. /**
  56. * Convert and format price value
  57. *
  58. * @param float $amount
  59. * @param bool $includeContainer
  60. * @param int $precision
  61. * @param null|string|bool|int|\Magento\Framework\App\ScopeInterface $scope
  62. * @param \Magento\Framework\Model\AbstractModel|string|null $currency
  63. * @return string
  64. */
  65. public function convertAndFormat(
  66. $amount,
  67. $includeContainer = true,
  68. $precision = self::DEFAULT_PRECISION,
  69. $scope = null,
  70. $currency = null
  71. );
  72. /**
  73. * Round price
  74. *
  75. * @deprecated 102.0.1
  76. * @param float $price
  77. * @return float
  78. */
  79. public function round($price);
  80. /**
  81. * Get currency model
  82. *
  83. * @param null|string|bool|int|\Magento\Framework\App\ScopeInterface $scope
  84. * @param \Magento\Framework\Model\AbstractModel|string|null $currency
  85. * @return \Magento\Framework\Model\AbstractModel
  86. */
  87. public function getCurrency($scope = null, $currency = null);
  88. /**
  89. * Get currency symbol
  90. *
  91. * @param null|string|bool|int|\Magento\Framework\App\ScopeInterface $scope
  92. * @param \Magento\Framework\Model\AbstractModel|string|null $currency
  93. * @return string
  94. */
  95. public function getCurrencySymbol($scope = null, $currency = null);
  96. }