1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
ValidationChecker.php
См. документацию.
1
<?php
2
3
declare(strict_types=1);
4
5
namespace
Bitrix\Main\Validation\Engine\AutoWire
;
6
7
use
Bitrix\Main\DI\ServiceLocator
;
8
use
Bitrix\Main\Engine\AutoWire\BinderArgumentException
;
9
use ReflectionParameter;
10
11
final
class
ValidationChecker
12
{
13
public
function
__construct
(
14
private
readonly ReflectionParameter $parameter,
15
private
readonly mixed $desiredValue
16
)
17
{
18
}
19
20
public
function
check
(): void
21
{
22
$validationService = ServiceLocator::getInstance()->get(
'main.validation.service'
);
23
24
$result
= $validationService->validateParameter($this->parameter, $this->desiredValue);
25
26
$error
=
$result
->getError();
27
if
(
$error
!==
null
)
28
{
29
throw
new
BinderArgumentException
(
30
"Invalid value to match parameter: [{$error->getCode()}] {$error->getMessage()}."
,
31
$this->parameter->getName()
32
);
33
}
34
}
35
}
Bitrix\Main\DI\ServiceLocator
Определения
servicelocator.php:19
Bitrix\Main\Engine\AutoWire\BinderArgumentException
Определения
binderargumentexception.php:9
Bitrix\Main\Validation\Engine\AutoWire\ValidationChecker
Определения
ValidationChecker.php:12
Bitrix\Main\Validation\Engine\AutoWire\ValidationChecker\__construct
__construct(private readonly ReflectionParameter $parameter, private readonly mixed $desiredValue)
Определения
ValidationChecker.php:13
Bitrix\Main\Validation\Engine\AutoWire\ValidationChecker\check
check()
Определения
ValidationChecker.php:20
$result
$result
Определения
get_property_values.php:14
Bitrix\Main\Validation\Engine\AutoWire
Определения
ValidationChecker.php:5
$error
$error
Определения
subscription_card_product.php:20
bitrix
modules
main
lib
Validation
Engine
AutoWire
ValidationChecker.php
Создано системой
1.14.0