CurrencyBundleInterface.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Intl\ResourceBundle;
  11. /**
  12. * Gives access to currency-related ICU data.
  13. *
  14. * @author Bernhard Schussek <bschussek@gmail.com>
  15. */
  16. interface CurrencyBundleInterface extends ResourceBundleInterface
  17. {
  18. /**
  19. * Returns the symbol used for a currency.
  20. *
  21. * @param string $currency A currency code (e.g. "EUR").
  22. * @param string $locale Optional. The locale to return the result in.
  23. * Defaults to {@link \Locale::getDefault()}.
  24. *
  25. * @return string|null The currency symbol or NULL if not found.
  26. */
  27. public function getCurrencySymbol($currency, $locale = null);
  28. /**
  29. * Returns the name of a currency.
  30. *
  31. * @param string $currency A currency code (e.g. "EUR").
  32. * @param string $locale Optional. The locale to return the name in.
  33. * Defaults to {@link \Locale::getDefault()}.
  34. *
  35. * @return string|null The name of the currency or NULL if not found.
  36. */
  37. public function getCurrencyName($currency, $locale = null);
  38. /**
  39. * Returns the names of all known currencies.
  40. *
  41. * @param string $locale Optional. The locale to return the names in.
  42. * Defaults to {@link \Locale::getDefault()}.
  43. *
  44. * @return string[] A list of currency names indexed by currency codes.
  45. */
  46. public function getCurrencyNames($locale = null);
  47. /**
  48. * Returns the number of digits after the comma of a currency.
  49. *
  50. * @param string $currency A currency code (e.g. "EUR").
  51. *
  52. * @return integer|null The number of digits after the comma or NULL if not found.
  53. */
  54. public function getFractionDigits($currency);
  55. /**
  56. * Returns the rounding increment of a currency.
  57. *
  58. * The rounding increment indicates to which number a currency is rounded.
  59. * For example, 1230 rounded to the nearest 50 is 1250. 1.234 rounded to the
  60. * nearest 0.65 is 1.3.
  61. *
  62. * @param string $currency A currency code (e.g. "EUR").
  63. *
  64. * @return float|integer|null The rounding increment or NULL if not found.
  65. */
  66. public function getRoundingIncrement($currency);
  67. }