Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\Validator\Constraints; Chris@0: Chris@0: use Symfony\Component\Validator\Constraint; Chris@0: use Symfony\Component\Validator\Exception\ConstraintDefinitionException; Chris@0: Chris@0: /** Chris@0: * Used for the comparison of values. Chris@0: * Chris@0: * @author Daniel Holmes Chris@0: * @author Bernhard Schussek Chris@0: */ Chris@0: abstract class AbstractComparison extends Constraint Chris@0: { Chris@0: public $message; Chris@0: public $value; Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function __construct($options = null) Chris@0: { Chris@0: if (is_array($options) && !isset($options['value'])) { Chris@0: throw new ConstraintDefinitionException(sprintf( Chris@0: 'The %s constraint requires the "value" option to be set.', Chris@0: get_class($this) Chris@0: )); Chris@0: } Chris@0: Chris@0: parent::__construct($options); Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function getDefaultOption() Chris@0: { Chris@0: return 'value'; Chris@0: } Chris@0: }