vendor/symfony/src/Symfony/Component/Validator/ConstraintValidator.php
changeset 0 7f95f8617b0b
equal deleted inserted replaced
-1:000000000000 0:7f95f8617b0b
       
     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  * @api
       
    16  */
       
    17 abstract class ConstraintValidator implements ConstraintValidatorInterface
       
    18 {
       
    19     /**
       
    20      * @var ExecutionContext
       
    21      */
       
    22     protected $context;
       
    23     /**
       
    24      * @var string
       
    25      */
       
    26     private $messageTemplate;
       
    27     /**
       
    28      * @var array
       
    29      */
       
    30     private $messageParameters;
       
    31 
       
    32     /**
       
    33      * {@inheritDoc}
       
    34      */
       
    35     public function initialize(ExecutionContext $context)
       
    36     {
       
    37         $this->context = $context;
       
    38         $this->messageTemplate = '';
       
    39         $this->messageParameters = array();
       
    40     }
       
    41 
       
    42     /**
       
    43      * {@inheritDoc}
       
    44      *
       
    45      * @api
       
    46      */
       
    47     public function getMessageTemplate()
       
    48     {
       
    49         return $this->messageTemplate;
       
    50     }
       
    51 
       
    52     /**
       
    53      * {@inheritDoc}
       
    54      *
       
    55      * @api
       
    56      */
       
    57     public function getMessageParameters()
       
    58     {
       
    59         return $this->messageParameters;
       
    60     }
       
    61 
       
    62     /**
       
    63      * @api
       
    64      */
       
    65     protected function setMessage($template, array $parameters = array())
       
    66     {
       
    67         $this->messageTemplate = $template;
       
    68         $this->messageParameters = $parameters;
       
    69     }
       
    70 }