1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
regexpvalidator.php
См. документацию.
1<?php
8
9namespace Bitrix\Main\ORM\Fields\Validators;
10
11use Bitrix\Main\ORM;
12use Bitrix\Main\ArgumentTypeException;
13use Bitrix\Main\Localization\Loc;
14
15Loc::loadMessages(__FILE__);
16
18{
22 protected $pattern;
23
27 protected $errorPhraseCode = 'MAIN_ENTITY_VALIDATOR_REGEXP';
28
35 public function __construct($pattern, $errorPhrase = null)
36 {
37 if (!is_string($pattern))
38 {
39 throw new ArgumentTypeException('pattern', 'string');
40 }
41
42 $this->pattern = $pattern;
43
44 parent::__construct($errorPhrase);
45 }
46
47
48 public function validate($value, $primary, array $row, ORM\Fields\Field $field)
49 {
50 if (preg_match($this->pattern, $value))
51 {
52 return true;
53 }
54
55 return $this->getErrorMessage($value, $field);
56 }
57}
validate($value, $primary, array $row, ORM\Fields\Field $field)
Определения regexpvalidator.php:48
__construct($pattern, $errorPhrase=null)
Определения regexpvalidator.php:35
getErrorMessage($value, ORM\Fields\Field $field, $errorPhrase=null, $additionalTemplates=null)
Определения validator.php:50
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804