1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
NotContainsUrlValidator.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
6
12
14{
15 public function validate(mixed $value): ValidationResult
16 {
18
19 if (!is_string($value))
20 {
21 $result->addError(new ValidationError(
22 'Value must be a string',
23 failedValidator: $this,
24 ));
25
26 return $result;
27 }
28
29 if (preg_match('/\b((https?:\/\/|www\.)[^\s]+)/iu', $value))
30 {
31 $result->addError(new ValidationError(
32 'Value must not contain URLs',
33 failedValidator: $this,
34 ));
35 }
36
37 return $result;
38 }
39}
$result
Определения get_property_values.php:14