* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator; use Psr\Container\ContainerInterface; use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\ValidatorException; /** * Uses a service container to create constraint validators. * * @author Kris Wallsmith */ class ContainerConstraintValidatorFactory implements ConstraintValidatorFactoryInterface { private $container; private $validators; public function __construct(ContainerInterface $container) { $this->container = $container; $this->validators = array(); } /** * {@inheritdoc} * * @throws ValidatorException When the validator class does not exist * @throws UnexpectedTypeException When the validator is not an instance of ConstraintValidatorInterface */ public function getInstance(Constraint $constraint) { $name = $constraint->validatedBy(); if (!isset($this->validators[$name])) { if ($this->container->has($name)) { $this->validators[$name] = $this->container->get($name); } else { if (!class_exists($name)) { throw new ValidatorException(sprintf('Constraint validator "%s" does not exist or it is not enabled. Check the "validatedBy" method in your constraint class "%s".', $name, get_class($constraint))); } $this->validators[$name] = new $name(); } } if (!$this->validators[$name] instanceof ConstraintValidatorInterface) { throw new UnexpectedTypeException($this->validators[$name], ConstraintValidatorInterface::class); } return $this->validators[$name]; } } __halt_compiler();----SIGNATURE:----iV221iqBIe8xo7/v1dgmrAlcKt5Ny3GCj96movpaKqAlaj4mJp9NF61oP+A28NY4OYcdP0sE8PqRk9br2LFP8viwd2OfNj0jv+9JZoltP4wqPoGunMB7L5+T7fwHGry+sYZtkaFKAcYkPzMfe07Il2X+/i45M1nCO5p1NjyM0LwUkXlqZPGk9+oO6NULmC1Ne74kTcFV37z43p49Hv70rWbFGJd9QsXuwXkHG+aeuSc3QInK3WxB6/M8civvPD1SwdkCBY38YlN+3ez9SteCugG8hwR0eGXPyCFkQob+NFWaR3JxltsEZuPaDrgE6HL+y/9DgdqlGqYCLMBnv6jZzb+dQeRfs5TmQFcOMPFB61QrjmYur695c9iqAE6U9ua2hT3bgDhsYhgxpHmGZY05qEEf21f5ex9eYVdWCPCwOClqT/n/IAWYqNlMi1XmSONTdmkI1cY+nWF1akMHDGYnaxE/M3FZ9xiASBHcF+NFv168ji3WHF3vlT7maRj4NX6VFrYtDkzK02KhTs6nODznPU1D1p8lEONojFvyOvM/m4bLW+8Xd88RGwmbOlMtcfxItPA/WcLYzyrC9aEFvXxMwdaAqqho2DXn3/T8/4eDixMAFHatzcMZ6/+FzM61JMXLlpjOwCVzYCu0UzM8Yxk1GVCDvxAGyox+hBFWvt7/zD4=----ATTACHMENT:----MzkxNzY5OTEyNDM4NjI5MSA1ODk5NjcyMDk3ODc1NzQgNzkwMjc0NDEyMzM0NTQyMg==