ConstraintViolationListInterface.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. public function add(ConstraintViolationInterface $violation);
  22. /**
  23. * Merges an existing violation list into this list.
  24. */
  25. public function addAll(ConstraintViolationListInterface $otherList);
  26. /**
  27. * Returns the violation at a given offset.
  28. *
  29. * @param int $offset The offset of the violation
  30. *
  31. * @return ConstraintViolationInterface The violation
  32. *
  33. * @throws \OutOfBoundsException if the offset does not exist
  34. */
  35. public function get($offset);
  36. /**
  37. * Returns whether the given offset exists.
  38. *
  39. * @param int $offset The violation offset
  40. *
  41. * @return bool Whether the offset exists
  42. */
  43. public function has($offset);
  44. /**
  45. * Sets a violation at a given offset.
  46. *
  47. * @param int $offset The violation offset
  48. * @param ConstraintViolationInterface $violation The violation
  49. */
  50. public function set($offset, ConstraintViolationInterface $violation);
  51. /**
  52. * Removes a violation at a given offset.
  53. *
  54. * @param int $offset The offset to remove
  55. */
  56. public function remove($offset);
  57. }