You are here

public function ConstraintViolationList::get in Plug 7

Returns the violation at a given offset.

@api

Parameters

int $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 lib/Symfony/validator/Symfony/Component/Validator/ConstraintViolationList.php

File

lib/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];
}