OperationInterface.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. public function getDomains(): array;
  37. /**
  38. * Returns all valid messages ('all') after operation.
  39. */
  40. public function getMessages(string $domain): array;
  41. /**
  42. * Returns new messages ('new') after operation.
  43. */
  44. public function getNewMessages(string $domain): array;
  45. /**
  46. * Returns obsolete messages ('obsolete') after operation.
  47. */
  48. public function getObsoleteMessages(string $domain): array;
  49. /**
  50. * Returns resulting catalogue ('result').
  51. */
  52. public function getResult(): MessageCatalogueInterface;
  53. }