Ei kuvausta

OperationInterface.php 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. * @param string $domain
  43. *
  44. * @return array
  45. */
  46. public function getMessages($domain);
  47. /**
  48. * Returns new messages ('new') after operation.
  49. *
  50. * @param string $domain
  51. *
  52. * @return array
  53. */
  54. public function getNewMessages($domain);
  55. /**
  56. * Returns obsolete messages ('obsolete') after operation.
  57. *
  58. * @param string $domain
  59. *
  60. * @return array
  61. */
  62. public function getObsoleteMessages($domain);
  63. /**
  64. * Returns resulting catalogue ('result').
  65. *
  66. * @return MessageCatalogueInterface
  67. */
  68. public function getResult();
  69. }