Drupal investigation

ConstraintViolationBuilderInterface.php 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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\Validator\Violation;
  11. /**
  12. * Builds {@link \Symfony\Component\Validator\ConstraintViolationInterface}
  13. * objects.
  14. *
  15. * Use the various methods on this interface to configure the built violation.
  16. * Finally, call {@link addViolation()} to add the violation to the current
  17. * execution context.
  18. *
  19. * @author Bernhard Schussek <bschussek@gmail.com>
  20. */
  21. interface ConstraintViolationBuilderInterface
  22. {
  23. /**
  24. * Stores the property path at which the violation should be generated.
  25. *
  26. * The passed path will be appended to the current property path of the
  27. * execution context.
  28. *
  29. * @param string $path The property path
  30. *
  31. * @return $this
  32. */
  33. public function atPath($path);
  34. /**
  35. * Sets a parameter to be inserted into the violation message.
  36. *
  37. * @param string $key The name of the parameter
  38. * @param string $value The value to be inserted in the parameter's place
  39. *
  40. * @return $this
  41. */
  42. public function setParameter($key, $value);
  43. /**
  44. * Sets all parameters to be inserted into the violation message.
  45. *
  46. * @param array $parameters An array with the parameter names as keys and
  47. * the values to be inserted in their place as
  48. * values
  49. *
  50. * @return $this
  51. */
  52. public function setParameters(array $parameters);
  53. /**
  54. * Sets the translation domain which should be used for translating the
  55. * violation message.
  56. *
  57. * @param string $translationDomain The translation domain
  58. *
  59. * @return $this
  60. *
  61. * @see \Symfony\Component\Translation\TranslatorInterface
  62. */
  63. public function setTranslationDomain($translationDomain);
  64. /**
  65. * Sets the invalid value that caused this violation.
  66. *
  67. * @param mixed $invalidValue The invalid value
  68. *
  69. * @return $this
  70. */
  71. public function setInvalidValue($invalidValue);
  72. /**
  73. * Sets the number which determines how the plural form of the violation
  74. * message is chosen when it is translated.
  75. *
  76. * @param int $number The number for determining the plural form
  77. *
  78. * @return $this
  79. *
  80. * @see \Symfony\Component\Translation\TranslatorInterface::transChoice()
  81. */
  82. public function setPlural($number);
  83. /**
  84. * Sets the violation code.
  85. *
  86. * @param string|null $code The violation code
  87. *
  88. * @return $this
  89. */
  90. public function setCode($code);
  91. /**
  92. * Sets the cause of the violation.
  93. *
  94. * @param mixed $cause The cause of the violation
  95. *
  96. * @return $this
  97. */
  98. public function setCause($cause);
  99. /**
  100. * Adds the violation to the current execution context.
  101. */
  102. public function addViolation();
  103. }