ConstraintViolationListInterface.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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;
  11. /**
  12. * A list of constraint violations.
  13. *
  14. * @author Bernhard Schussek <bschussek@gmail.com>
  15. */
  16. interface ConstraintViolationListInterface extends \Traversable, \Countable, \ArrayAccess
  17. {
  18. /**
  19. * Adds a constraint violation to this list.
  20. *
  21. * @param ConstraintViolationInterface $violation The violation to add
  22. */
  23. public function add(ConstraintViolationInterface $violation);
  24. /**
  25. * Merges an existing violation list into this list.
  26. *
  27. * @param ConstraintViolationListInterface $otherList The list to merge
  28. */
  29. public function addAll(ConstraintViolationListInterface $otherList);
  30. /**
  31. * Returns the violation at a given offset.
  32. *
  33. * @param int $offset The offset of the violation
  34. *
  35. * @return ConstraintViolationInterface The violation
  36. *
  37. * @throws \OutOfBoundsException If the offset does not exist.
  38. */
  39. public function get($offset);
  40. /**
  41. * Returns whether the given offset exists.
  42. *
  43. * @param int $offset The violation offset
  44. *
  45. * @return bool Whether the offset exists
  46. */
  47. public function has($offset);
  48. /**
  49. * Sets a violation at a given offset.
  50. *
  51. * @param int $offset The violation offset
  52. * @param ConstraintViolationInterface $violation The violation
  53. */
  54. public function set($offset, ConstraintViolationInterface $violation);
  55. /**
  56. * Removes a violation at a given offset.
  57. *
  58. * @param int $offset The offset to remove
  59. */
  60. public function remove($offset);
  61. }