api/symfony/Component/Form/FormErrorIterator.yaml

210 lines
6.2 KiB
YAML
Raw Permalink Normal View History

2024-09-26 09:03:21 +00:00
name: FormErrorIterator
class_comment: '# * Iterates over the errors of a form.
# *
# * This class supports recursive iteration. In order to iterate recursively,
# * pass a structure of {@link FormError} and {@link FormErrorIterator} objects
# * to the $errors constructor argument.
# *
# * You can also wrap the iterator into a {@link \RecursiveIteratorIterator} to
# * flatten the recursive structure into a flat list of errors.
# *
# * @author Bernhard Schussek <bschussek@gmail.com>
# *
# * @template T of FormError|FormErrorIterator
# *
# * @implements \ArrayAccess<int, T>
# * @implements \RecursiveIterator<int, T>
# * @implements \SeekableIterator<int, T>'
dependencies:
- name: BadMethodCallException
type: class
source: Symfony\Component\Form\Exception\BadMethodCallException
- name: InvalidArgumentException
type: class
source: Symfony\Component\Form\Exception\InvalidArgumentException
- name: LogicException
type: class
source: Symfony\Component\Form\Exception\LogicException
- name: OutOfBoundsException
type: class
source: Symfony\Component\Form\Exception\OutOfBoundsException
- name: ConstraintViolation
type: class
source: Symfony\Component\Validator\ConstraintViolation
properties: []
methods:
- name: __construct
visibility: public
parameters:
- name: form
- name: errors
comment: "# * Iterates over the errors of a form.\n# *\n# * This class supports\
\ recursive iteration. In order to iterate recursively,\n# * pass a structure\
\ of {@link FormError} and {@link FormErrorIterator} objects\n# * to the $errors\
\ constructor argument.\n# *\n# * You can also wrap the iterator into a {@link\
\ \\RecursiveIteratorIterator} to\n# * flatten the recursive structure into a\
\ flat list of errors.\n# *\n# * @author Bernhard Schussek <bschussek@gmail.com>\n\
# *\n# * @template T of FormError|FormErrorIterator\n# *\n# * @implements \\ArrayAccess<int,\
\ T>\n# * @implements \\RecursiveIterator<int, T>\n# * @implements \\SeekableIterator<int,\
\ T>\n# */\n# class FormErrorIterator implements \\RecursiveIterator, \\SeekableIterator,\
\ \\ArrayAccess, \\Countable, \\Stringable\n# {\n# /**\n# * The prefix used for\
\ indenting nested error messages.\n# */\n# public const INDENTATION = ' ';\n\
# \n# /**\n# * @var list<T>\n# */\n# private array $errors;\n# \n# /**\n# * @param\
\ list<T> $errors\n# *\n# * @throws InvalidArgumentException If the errors are\
\ invalid"
- name: __toString
visibility: public
parameters: []
comment: '# * Returns all iterated error messages as string.'
- name: getForm
visibility: public
parameters: []
comment: '# * Returns the iterated form.'
- name: current
visibility: public
parameters: []
comment: '# * Returns the current element of the iterator.
# *
# * @return T An error or an iterator containing nested errors'
- name: next
visibility: public
parameters: []
comment: '# * Advances the iterator to the next position.'
- name: key
visibility: public
parameters: []
comment: '# * Returns the current position of the iterator.'
- name: valid
visibility: public
parameters: []
comment: '# * Returns whether the iterator''s position is valid.'
- name: rewind
visibility: public
parameters: []
comment: '# * Sets the iterator''s position to the beginning.
# *
# * This method detects if errors have been added to the form since the
# * construction of the iterator.'
- name: offsetExists
visibility: public
parameters:
- name: position
comment: '# * Returns whether a position exists in the iterator.
# *
# * @param int $position The position'
- name: offsetGet
visibility: public
parameters:
- name: position
comment: '# * Returns the element at a position in the iterator.
# *
# * @param int $position The position
# *
# * @return T
# *
# * @throws OutOfBoundsException If the given position does not exist'
- name: offsetSet
visibility: public
parameters:
- name: position
- name: value
comment: '# * Unsupported method.
# *
# * @throws BadMethodCallException'
- name: offsetUnset
visibility: public
parameters:
- name: position
comment: '# * Unsupported method.
# *
# * @throws BadMethodCallException'
- name: hasChildren
visibility: public
parameters: []
comment: '# * Returns whether the current element of the iterator can be recursed
# * into.'
- name: getChildren
visibility: public
parameters: []
comment: null
- name: count
visibility: public
parameters: []
comment: "# @var self $children */\n# $children = current($this->errors);\n# \n\
# return $children;\n# }\n# \n# /**\n# * Returns the number of elements in the\
\ iterator.\n# *\n# * Note that this is not the total number of errors, if the\
\ constructor\n# * parameter $deep was set to true! In that case, you should wrap\
\ the\n# * iterator into a {@link \\RecursiveIteratorIterator} with the standard\
\ mode\n# * {@link \\RecursiveIteratorIterator::LEAVES_ONLY} and count the result.\n\
# *\n# * $iterator = new \\RecursiveIteratorIterator($form->getErrors(true));\n\
# * $count = count(iterator_to_array($iterator));\n# *\n# * Alternatively,\
\ set the constructor argument $flatten to true as well.\n# *\n# * $count\
\ = count($form->getErrors(true, true));"
- name: seek
visibility: public
parameters:
- name: position
comment: '# * Sets the position of the iterator.
# *
# * @throws OutOfBoundsException If the position is invalid'
- name: findByCodes
visibility: public
parameters:
- name: codes
comment: '# * Creates iterator for errors with specific codes.
# *
# * @param string|string[] $codes The codes to find'
- name: indent
visibility: private
parameters:
- name: string
comment: '# * Utility function for indenting multi-line strings.'
traits:
- Symfony\Component\Form\Exception\BadMethodCallException
- Symfony\Component\Form\Exception\InvalidArgumentException
- Symfony\Component\Form\Exception\LogicException
- Symfony\Component\Form\Exception\OutOfBoundsException
- Symfony\Component\Validator\ConstraintViolation
interfaces:
- \ArrayAccess
- \RecursiveIterator
- \SeekableIterator
- \RecursiveIterator