ConstraintViolationListInterface.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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(self $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(int $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(int $offset);
  44. /**
  45. * Sets a violation at a given offset.
  46. *
  47. * @param int $offset The violation offset
  48. */
  49. public function set(int $offset, ConstraintViolationInterface $violation);
  50. /**
  51. * Removes a violation at a given offset.
  52. *
  53. * @param int $offset The offset to remove
  54. */
  55. public function remove(int $offset);
  56. }