1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
InArrayValidator.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
5namespace Bitrix\Main\Validation\Validator;
6
7use Bitrix\Main\Localization\LocalizableMessage;
8use Bitrix\Main\Validation\ValidationError;
9use Bitrix\Main\Validation\ValidationResult;
10
12{
13 public function __construct(
14 private readonly array $validValues,
15 private readonly bool $strict = false
16 )
17 {
18 }
19
20 public function validate(mixed $value): ValidationResult
21 {
23
24 if (!in_array($value, $this->validValues, $this->strict))
25 {
26 $result->addError(new ValidationError(
27 new LocalizableMessage('MAIN_VALIDATION_IN_ARRAY'),
28 failedValidator: $this
29 ));
30 }
31
32 return $result;
33 }
34}
__construct(private readonly array $validValues, private readonly bool $strict=false)
Определения InArrayValidator.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14