Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / validator / Constraints / AbstractComparison.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\Constraints;
13
14 use Symfony\Component\Validator\Constraint;
15 use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
16
17 /**
18  * Used for the comparison of values.
19  *
20  * @author Daniel Holmes <daniel@danielholmes.org>
21  * @author Bernhard Schussek <bschussek@gmail.com>
22  */
23 abstract class AbstractComparison extends Constraint
24 {
25     public $message;
26     public $value;
27
28     /**
29      * {@inheritdoc}
30      */
31     public function __construct($options = null)
32     {
33         if (null === $options) {
34             $options = array();
35         }
36
37         if (is_array($options) && !isset($options['value'])) {
38             throw new ConstraintDefinitionException(sprintf(
39                 'The %s constraint requires the "value" option to be set.',
40                 get_class($this)
41             ));
42         }
43
44         parent::__construct($options);
45     }
46
47     /**
48      * {@inheritdoc}
49      */
50     public function getDefaultOption()
51     {
52         return 'value';
53     }
54 }