1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
PhoneOrEmail.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
5namespace Bitrix\Main\Validation\Rule;
6
7use Attribute;
8use Bitrix\Main\Localization\LocalizableMessageInterface;
9use Bitrix\Main\Validation\ValidationResult;
10use Bitrix\Main\Validation\Validator\PhoneValidator;
11use Bitrix\Main\Validation\Validator\EmailValidator;
12
13#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_PARAMETER)]
15{
17
18 public function __construct(
19 private readonly bool $strict = false,
20 private readonly bool $domainCheck = false,
22 )
23 {
24 $this->errorMessage = $errorMessage;
25 }
26
28 {
29 $phoneResult = (new PhoneValidator())->validate($propertyValue);
30 if ($phoneResult->isSuccess())
31 {
32 return $this->replaceWithCustomError($phoneResult);
33 }
34
35 $emailResult = (new EmailValidator($this->strict, $this->domainCheck))->validate($propertyValue);
36
37 return $this->replaceWithCustomError($emailResult);
38 }
39}
__construct(private readonly bool $strict=false, private readonly bool $domainCheck=false, string|LocalizableMessageInterface|null $errorMessage=null)
Определения PhoneOrEmail.php:18
validateProperty(mixed $propertyValue)
Определения PhoneOrEmail.php:27
</td ></tr ></table ></td ></tr ><?endif?><? $propertyIndex=0;foreach( $arGlobalProperties as $propertyCode=> $propertyValue
Определения file_new.php:729
while($arParentIBlockProperty=$dbParentIBlockProperty->Fetch()) $errorMessage
replaceWithCustomError(ValidationResult $result, ?ValidatorInterface $validator=null)
Определения ValidationErrorTrait.php:21