/var/www/vhosts/nabawater/vendor/yiisoft/yii2/validators
NameSizeModeActions
BooleanValidator.php30150644editdlrm
CompareValidator.php106530644editdlrm
DateValidator.php191390644editdlrm
DefaultValueValidator.php15220644editdlrm
EachValidator.php64190644editdlrm
EmailValidator.php58210644editdlrm
ExistValidator.php125310644editdlrm
FileValidator.php196700644editdlrm
FilterValidator.php28540644editdlrm
ImageValidator.php74340644editdlrm
InlineValidator.php28530644editdlrm
IpValidator.php197840644editdlrm
NumberValidator.php61460644editdlrm
PunycodeAsset.php5150644editdlrm
RangeValidator.php39240644editdlrm
RegularExpressionValidator.php25220644editdlrm
RequiredValidator.php39340644editdlrm
SafeValidator.php16510644editdlrm
StringValidator.php67220644editdlrm
UniqueValidator.php135250644editdlrm
UrlValidator.php52920644editdlrm
ValidationAsset.php5470644editdlrm
Validator.php201990644editdlrm
Edit: /var/www/vhosts/nabawater/vendor/yiisoft/yii2/validators/RegularExpressionValidator.php (2522B)
* @since 2.0 */ class RegularExpressionValidator extends Validator { /** * @var string the regular expression to be matched with */ public $pattern; /** * @var bool whether to invert the validation logic. Defaults to false. If set to true, * the regular expression defined via [[pattern]] should NOT match the attribute value. */ public $not = false; /** * {@inheritdoc} */ public function init() { parent::init(); if ($this->pattern === null) { throw new InvalidConfigException('The "pattern" property must be set.'); } if ($this->message === null) { $this->message = Yii::t('yii', '{attribute} is invalid.'); } } /** * {@inheritdoc} */ protected function validateValue($value) { $valid = !is_array($value) && (!$this->not && preg_match($this->pattern, $value) || $this->not && !preg_match($this->pattern, $value)); return $valid ? null : [$this->message, []]; } /** * {@inheritdoc} */ public function clientValidateAttribute($model, $attribute, $view) { ValidationAsset::register($view); $options = $this->getClientOptions($model, $attribute); return 'yii.validation.regularExpression(value, messages, ' . Json::htmlEncode($options) . ');'; } /** * {@inheritdoc} */ public function getClientOptions($model, $attribute) { $pattern = Html::escapeJsRegularExpression($this->pattern); $options = [ 'pattern' => new JsExpression($pattern), 'not' => $this->not, 'message' => $this->formatMessage($this->message, [ 'attribute' => $model->getAttributeLabel($attribute), ]), ]; if ($this->skipOnEmpty) { $options['skipOnEmpty'] = 1; } return $options; } }