Version 1
[yaffs-website] / vendor / symfony / validator / ValidatorInterface.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 and graphs of objects and arrays.
16  *
17  * @author Bernhard Schussek <bschussek@gmail.com>
18  *
19  * @deprecated since version 2.5, to be removed in 3.0.
20  *             Use {@link \Symfony\Component\Validator\Validator\ValidatorInterface} instead.
21  */
22 interface ValidatorInterface
23 {
24     /**
25      * Validates a value.
26      *
27      * The accepted values depend on the {@link MetadataFactoryInterface}
28      * implementation.
29      *
30      * The signature changed with Symfony 2.5 (see
31      * {@link Validator\ValidatorInterface::validate()}. This signature will be
32      * disabled in Symfony 3.0.
33      *
34      * @param mixed      $value    The value to validate
35      * @param array|null $groups   The validation groups to validate
36      * @param bool       $traverse Whether to traverse the value if it is traversable
37      * @param bool       $deep     Whether to traverse nested traversable values recursively
38      *
39      * @return ConstraintViolationListInterface A list of constraint violations. If the
40      *                                          list is empty, validation succeeded.
41      */
42     public function validate($value, $groups = null, $traverse = false, $deep = false);
43
44     /**
45      * Validates a property of a value against its current value.
46      *
47      * The accepted values depend on the {@link MetadataFactoryInterface}
48      * implementation.
49      *
50      * @param mixed      $containingValue The value containing the property
51      * @param string     $property        The name of the property to validate
52      * @param array|null $groups          The validation groups to validate
53      *
54      * @return ConstraintViolationListInterface A list of constraint violations. If the
55      *                                          list is empty, validation succeeded.
56      */
57     public function validateProperty($containingValue, $property, $groups = null);
58
59     /**
60      * Validate a property of a value against a potential value.
61      *
62      * The accepted values depend on the {@link MetadataFactoryInterface}
63      * implementation.
64      *
65      * @param mixed      $containingValue The value containing the property
66      * @param string     $property        The name of the property to validate
67      * @param string     $value           The value to validate against the
68      *                                    constraints of the property.
69      * @param array|null $groups          The validation groups to validate
70      *
71      * @return ConstraintViolationListInterface A list of constraint violations. If the
72      *                                          list is empty, validation succeeded.
73      */
74     public function validatePropertyValue($containingValue, $property, $value, $groups = null);
75
76     /**
77      * Validates a value against a constraint or a list of constraints.
78      *
79      * @param mixed                   $value       The value to validate
80      * @param Constraint|Constraint[] $constraints The constraint(s) to validate against
81      * @param array|null              $groups      The validation groups to validate
82      *
83      * @return ConstraintViolationListInterface A list of constraint violations. If the
84      *                                          list is empty, validation succeeded.
85      *
86      * @deprecated since version 2.5, to be removed in 3.0.
87      *             Renamed to {@link Validator\ValidatorInterface::validate()}
88      *             in Symfony 2.5.
89      */
90     public function validateValue($value, $constraints, $groups = null);
91
92     /**
93      * Returns the factory for metadata instances.
94      *
95      * @return MetadataFactoryInterface The metadata factory
96      *
97      * @deprecated since version 2.5, to be removed in 3.0.
98      *             Use {@link Validator\ValidatorInterface::getMetadataFor()} or
99      *             {@link Validator\ValidatorInterface::hasMetadataFor()}
100      *             instead.
101      */
102     public function getMetadataFactory();
103 }