Command
3 years ago
Constraints
3 years ago
Context
3 years ago
Exception
3 years ago
Mapping
3 years ago
Util
3 years ago
Validator
3 years ago
Violation
3 years ago
Constraint.php
4 years ago
ConstraintValidator.php
4 years ago
ConstraintValidatorFactory.php
4 years ago
ConstraintValidatorFactoryInterface.php
4 years ago
ConstraintValidatorInterface.php
4 years ago
ConstraintViolation.php
4 years ago
ConstraintViolationInterface.php
4 years ago
ConstraintViolationList.php
4 years ago
ConstraintViolationListInterface.php
4 years ago
ContainerConstraintValidatorFactory.php
4 years ago
GroupSequenceProviderInterface.php
4 years ago
ObjectInitializerInterface.php
4 years ago
Validation.php
4 years ago
ValidatorBuilder.php
4 years ago
index.php
3 years ago
ConstraintValidatorFactory.php
20 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Symfony\Component\Validator; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Symfony\Component\Validator\Constraints\ExpressionValidator; |
| 5 | class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface |
| 6 | { |
| 7 | protected $validators = []; |
| 8 | public function __construct() |
| 9 | { |
| 10 | } |
| 11 | public function getInstance(Constraint $constraint) |
| 12 | { |
| 13 | $className = $constraint->validatedBy(); |
| 14 | if (!isset($this->validators[$className])) { |
| 15 | $this->validators[$className] = 'validator.expression' === $className ? new ExpressionValidator() : new $className(); |
| 16 | } |
| 17 | return $this->validators[$className]; |
| 18 | } |
| 19 | } |
| 20 |