Fix bug in style changes for the Use cases on the live site.
[yaffs-website] / vendor / symfony / validator / ValidationVisitorInterface.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\Validator;
13
14 /**
15  * Validates values against constraints defined in {@link MetadataInterface}
16  * instances.
17  *
18  * This interface is an implementation of the Visitor design pattern. A value
19  * is validated by first passing it to the {@link validate} method. That method
20  * will determine the matching {@link MetadataInterface} for validating the
21  * value. It then calls the {@link MetadataInterface::accept} method of that
22  * metadata. <tt>accept()</tt> does two things:
23  *
24  * <ol>
25  * <li>It calls {@link visit} to validate the value against the constraints of
26  * the metadata.</li>
27  * <li>It calls <tt>accept()</tt> on all nested metadata instances with the
28  * corresponding values extracted from the current value. For example, if the
29  * current metadata represents a class and the current value is an object of
30  * that class, the metadata contains nested instances for each property of that
31  * class. It forwards the call to these nested metadata with the values of the
32  * corresponding properties in the original object.</li>
33  * </ol>
34  *
35  * @author Bernhard Schussek <bschussek@gmail.com>
36  *
37  * @deprecated since version 2.5, to be removed in 3.0.
38  */
39 interface ValidationVisitorInterface
40 {
41     /**
42      * Validates a value.
43      *
44      * If the value is an array or a traversable object, you can set the
45      * parameter <tt>$traverse</tt> to <tt>true</tt> in order to run through
46      * the collection and validate each element. If these elements can be
47      * collections again and you want to traverse them recursively, set the
48      * parameter <tt>$deep</tt> to <tt>true</tt> as well.
49      *
50      * If you set <tt>$traversable</tt> to <tt>true</tt>, the visitor will
51      * nevertheless try to find metadata for the collection and validate its
52      * constraints. If no such metadata is found, the visitor ignores that and
53      * only iterates the collection.
54      *
55      * If you don't set <tt>$traversable</tt> to <tt>true</tt> and the visitor
56      * does not find metadata for the given value, it will fail with an
57      * exception.
58      *
59      * @param mixed  $value        The value to validate
60      * @param string $group        The validation group to validate
61      * @param string $propertyPath The current property path in the validation graph
62      * @param bool   $traverse     Whether to traverse the value if it is traversable
63      * @param bool   $deep         Whether to traverse nested traversable values recursively
64      *
65      * @throws Exception\NoSuchMetadataException If no metadata can be found for
66      *                                           the given value.
67      */
68     public function validate($value, $group, $propertyPath, $traverse = false, $deep = false);
69
70     /**
71      * Validates a value against the constraints defined in some metadata.
72      *
73      * This method implements the Visitor design pattern. See also
74      * {@link ValidationVisitorInterface}.
75      *
76      * @param MetadataInterface $metadata     The metadata holding the constraints
77      * @param mixed             $value        The value to validate
78      * @param string            $group        The validation group to validate
79      * @param string            $propertyPath The current property path in the validation graph
80      */
81     public function visit(MetadataInterface $metadata, $value, $group, $propertyPath);
82 }