public function ConstraintViolationList::get

Returns the violation at a given offset.

@api

Parameters

integer $offset The offset of the violation.:

Return value

ConstraintViolationInterface The violation.

Throws

\OutOfBoundsException If the offset does not exist.

Overrides ConstraintViolationListInterface::get

1 call to ConstraintViolationList::get()
ConstraintViolationList::offsetGet in drupal/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintViolationList.php

File

drupal/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintViolationList.php, line 75

Class

ConstraintViolationList
Default implementation of {@ConstraintViolationListInterface}.

Namespace

Symfony\Component\Validator

Code

public function get($offset) {
  if (!isset($this->violations[$offset])) {
    throw new \OutOfBoundsException(sprintf('The offset "%s" does not exist.', $offset));
  }
  return $this->violations[$offset];
}