vendor/friendsofsymfony/rest-bundle/Validator/Constraints/Regex.php line 23

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the FOSRestBundle package.
  4.  *
  5.  * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace FOS\RestBundle\Validator\Constraints;
  11. use FOS\RestBundle\Util\ResolverTrait;
  12. use Symfony\Component\DependencyInjection\ContainerInterface;
  13. use Symfony\Component\Validator\Constraints\Regex as BaseRegex;
  14. /**
  15.  * @Annotation
  16.  *
  17.  * @author Ener-Getick <egetick@gmail.com>
  18.  */
  19. class Regex extends BaseRegex implements ResolvableConstraintInterface
  20. {
  21.     use ResolverTrait;
  22.     private $resolved;
  23.     /**
  24.      * {@inheritdoc}
  25.      */
  26.     public function validatedBy()
  27.     {
  28.         return 'Symfony\Component\Validator\Constraints\RegexValidator';
  29.     }
  30.     public function resolve(ContainerInterface $container)
  31.     {
  32.         if ($this->resolved) {
  33.             return;
  34.         }
  35.         $this->pattern $this->resolveValue($container$this->pattern);
  36.         $this->resolved true;
  37.     }
  38. }