<commit_before><?php

/*
 * This file is part of the Symfony package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Validator;

use Symfony\Component\Validator\Exception\ValidatorException;

/**
 * Base class for constraint validators
 *
 * @author <NAME> <<EMAIL>>
 *
 * @api
 */
abstract class ConstraintValidator implements ConstraintValidatorInterface
{
    /**
     * @var ExecutionContext
     */
    protected $context;

    /**
     * @var string
     *
     * @deprecated
     */
    private $messageTemplate;

    /**
     * @var array
     *
     * @deprecated
     */
    private $messageParameters;

    /**
     * {@inheritDoc}
     */
    public function initialize(ExecutionContext $context)
    {
        $this->context = $context;
        $this->messageTemplate = '';
        $this->messageParameters = array();
    }

    /**
     * {@inheritDoc}
     *
     * @deprecated Deprecated since version 2.1, to be removed in 2.3.
     */
    public function getMessageTemplate()
    {
        return $this->messageTemplate;
    }

    /**
     * {@inheritDoc}
     *
     * @deprecated Deprecated since version 2.1, to be removed in 2.3.
     */
    public function getMessageParameters()
    {
        return $this->messageParameters;
    }

    /**
     * Wrapper for $this->context->addViolation()
     *
     * @deprecated Deprecated since version 2.1, to be removed in 2.3.
     */
    protected function setMessage($template, array $parameters = array())
    {
        $this->messageTemplate = $template;
        $this->messageParameters = $parameters;

        if (!$this->context instanceof ExecutionContext) {
            throw new ValidatorException('ConstraintValidator::initialize() must be called before setting violation messages');
        }

        $this->context->addViolation($template, $parameters);
    }

    /**
     * Stub implementation delegating to the deprecated isValid method.
     *
     * This stub exists for BC and will be dropped in Symfony 2.3.
     *
     * @see ConstraintValidatorInterface::validate
     */
    public function validate($value, Constraint $constraint)
    {
        return $this->isValid($valoue, $constraint);
    }

    /**
     * BC variant of validate.
     *
     * @deprecated Deprecated since version 2.1, to be removed in 2.3.
     */
    protected function isValid($value, Constraint $constraint)
    {
    }
}<commit_msg>[Validator] Fixed typo, updated CHANGELOG and UPGRADE<commit_after><?php

/*
 * This file is part of the Symfony package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Validator;

use Symfony\Component\Validator\Exception\ValidatorException;

/**
 * Base class for constraint validators
 *
 * @author <NAME> <<EMAIL>>
 *
 * @api
 */
abstract class ConstraintValidator implements ConstraintValidatorInterface
{
    /**
     * @var ExecutionContext
     */
    protected $context;

    /**
     * @var string
     *
     * @deprecated
     */
    private $messageTemplate;

    /**
     * @var array
     *
     * @deprecated
     */
    private $messageParameters;

    /**
     * {@inheritDoc}
     */
    public function initialize(ExecutionContext $context)
    {
        $this->context = $context;
        $this->messageTemplate = '';
        $this->messageParameters = array();
    }

    /**
     * {@inheritDoc}
     *
     * @deprecated Deprecated since version 2.1, to be removed in 2.3.
     */
    public function getMessageTemplate()
    {
        return $this->messageTemplate;
    }

    /**
     * {@inheritDoc}
     *
     * @deprecated Deprecated since version 2.1, to be removed in 2.3.
     */
    public function getMessageParameters()
    {
        return $this->messageParameters;
    }

    /**
     * Wrapper for $this->context->addViolation()
     *
     * @deprecated Deprecated since version 2.1, to be removed in 2.3.
     */
    protected function setMessage($template, array $parameters = array())
    {
        $this->messageTemplate = $template;
        $this->messageParameters = $parameters;

        if (!$this->context instanceof ExecutionContext) {
            throw new ValidatorException('ConstraintValidator::initialize() must be called before setting violation messages');
        }

        $this->context->addViolation($template, $parameters);
    }

    /**
     * Stub implementation delegating to the deprecated isValid method.
     *
     * This stub exists for BC and will be dropped in Symfony 2.3.
     *
     * @see ConstraintValidatorInterface::validate
     */
    public function validate($value, Constraint $constraint)
    {
        return $this->isValid($value, $constraint);
    }

    /**
     * BC variant of validate.
     *
     * @deprecated Deprecated since version 2.1, to be removed in 2.3.
     */
    protected function isValid($value, Constraint $constraint)
    {
    }
}
{'fraction_non_alphanumeric': 0.11444726067459544, 'fraction_numerical': 0.007018912068629362, 'mean_word_length': 2.4086378737541527, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6237904', 'n_tokens_mistral': 1418, 'n_tokens_neox': 1397, 'n_words': 392}