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

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. use Symfony\Component\Validator\Constraints\RegexValidator;
  15. /**
  16.  * @Annotation
  17.  *
  18.  * @author Ener-Getick <egetick@gmail.com>
  19.  */
  20. class Regex extends BaseRegex implements ResolvableConstraintInterface
  21. {
  22.     use ResolverTrait;
  23.     private $resolved;
  24.     /**
  25.      * {@inheritdoc}
  26.      */
  27.     public function validatedBy(): string
  28.     {
  29.         return RegexValidator::class;
  30.     }
  31.     public function resolve(ContainerInterface $container): void
  32.     {
  33.         if ($this->resolved) {
  34.             return;
  35.         }
  36.         $this->pattern $this->resolveValue($container$this->pattern);
  37.         $this->resolved true;
  38.     }
  39. }