• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/engine/autowire/exactparameter.php
  • Класс: BitrixMainEngineAutoWireExactParameter
  • Вызов: ExactParameter::captureData
public function captureData(ReflectionParameter $parameter, array $sourceParameters, array $autoWiredParameters = [])
{
	$result = new Result();

	if (!$this->needToMapExternalData())
	{
		return $result;
	}

	$binder = Binder::buildForFunction($this->getConstructor());
	$binder->setAutoWiredParameters($autoWiredParameters);

	$reflectionClass = $this->buildReflectionClass($parameter);
	if (!$reflectionClass)
	{
		throw new BinderArgumentException("Could not retrieve \ReflectionClass for {$parameter->getName()}.");
	}

	array_unshift($sourceParameters, ['className' => $reflectionClass->getName()]);
	$binder->setSourcesParametersToMap($sourceParameters);
	try
	{
		$capturedParameters = $binder->getArgs();
		$result->setData($capturedParameters);
	}
	catch (BinderArgumentException $e)
	{
		$result->addError(new Error($e->getMessage()));
	}

	return $result;
}