Respect\Validation\Rules\Regex::__construct PHP Method

__construct() public method

public __construct ( $regex )
    public function __construct($regex)
    {
        $this->regex = $regex;
    }

Usage Example

Example #1
0
 public function __construct($countryCode, CountryCode $countryCodeRule = null)
 {
     $countryCodeRule = $countryCodeRule ?: new CountryCode();
     if (!$countryCodeRule->validate($countryCode)) {
         throw new ComponentException(sprintf('Cannot validate postal code from "%s" country', $countryCode));
     }
     $regex = self::DEFAULT_PATTERN;
     $upperCountryCode = strtoupper($countryCode);
     if (isset($this->postalCodes[$upperCountryCode])) {
         $regex = $this->postalCodes[$upperCountryCode];
     }
     parent::__construct($regex);
 }
All Usage Examples Of Respect\Validation\Rules\Regex::__construct