OperationInterface.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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\Catalogue;
  11. use Symfony\Component\Translation\MessageCatalogueInterface;
  12. /**
  13. * Represents an operation on catalogue(s).
  14. *
  15. * An instance of this interface performs an operation on one or more catalogues and
  16. * stores intermediate and final results of the operation.
  17. *
  18. * The first catalogue in its argument(s) is called the 'source catalogue' or 'source' and
  19. * the following results are stored:
  20. *
  21. * Messages: also called 'all', are valid messages for the given domain after the operation is performed.
  22. *
  23. * New Messages: also called 'new' (new = all ∖ source = {x: x ∈ all ∧ x ∉ source}).
  24. *
  25. * Obsolete Messages: also called 'obsolete' (obsolete = source ∖ all = {x: x ∈ source ∧ x ∉ all}).
  26. *
  27. * Result: also called 'result', is the resulting catalogue for the given domain that holds the same messages as 'all'.
  28. *
  29. * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
  30. */
  31. interface OperationInterface
  32. {
  33. /**
  34. * Returns domains affected by operation.
  35. *
  36. * @return array
  37. */
  38. public function getDomains();
  39. /**
  40. * Returns all valid messages ('all') after operation.
  41. *
  42. * @return array
  43. */
  44. public function getMessages(string $domain);
  45. /**
  46. * Returns new messages ('new') after operation.
  47. *
  48. * @return array
  49. */
  50. public function getNewMessages(string $domain);
  51. /**
  52. * Returns obsolete messages ('obsolete') after operation.
  53. *
  54. * @return array
  55. */
  56. public function getObsoleteMessages(string $domain);
  57. /**
  58. * Returns resulting catalogue ('result').
  59. *
  60. * @return MessageCatalogueInterface
  61. */
  62. public function getResult();
  63. }