MetadataAwareInterface.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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\Translation;
  11. /**
  12. * MetadataAwareInterface.
  13. *
  14. * @author Fabien Potencier <fabien@symfony.com>
  15. */
  16. interface MetadataAwareInterface
  17. {
  18. /**
  19. * Gets metadata for the given domain and key.
  20. *
  21. * Passing an empty domain will return an array with all metadata indexed by
  22. * domain and then by key. Passing an empty key will return an array with all
  23. * metadata for the given domain.
  24. *
  25. * @param string $key The key
  26. * @param string $domain The domain name
  27. *
  28. * @return mixed The value that was set or an array with the domains/keys or null
  29. */
  30. public function getMetadata(string $key = '', string $domain = 'messages');
  31. /**
  32. * Adds metadata to a message domain.
  33. *
  34. * @param string $key The key
  35. * @param mixed $value The value
  36. * @param string $domain The domain name
  37. */
  38. public function setMetadata(string $key, $value, string $domain = 'messages');
  39. /**
  40. * Deletes metadata for the given key and domain.
  41. *
  42. * Passing an empty domain will delete all metadata. Passing an empty key will
  43. * delete all metadata for the given domain.
  44. *
  45. * @param string $key The key
  46. * @param string $domain The domain name
  47. */
  48. public function deleteMetadata(string $key = '', string $domain = 'messages');
  49. }