Operation::getMethodSignature

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Operation
  4. getMethodSignature
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/dispatcher/operation.php
  • Класс: BitrixTasksDispatcherOperation
  • Вызов: Operation::getMethodSignature
protected function getMethodSignature()
{
	$info = new ReflectionMethod($this->parsed['CLASS'], $this->parsed['METHOD']);
	$result = [
		'STATIC' => $info->isStatic(),
		'ARGUMENTS' => [],
	];
	$arguments = $info->getParameters();
	if (is_array($arguments))
	{
		foreach ($arguments as $arg)
		{
			$optional = $arg->isOptional();
			$argName = ToLower($arg->getName());
			$argType = $arg->getType();
			if (!$argType)
			{
				$isArrayType = false;
			}
			else
			{
				$types = ($argType instanceof ReflectionUnionType ? $argType->getTypes() : [$argType]);
				$isArrayType = in_array(
					'array',
					array_map(static fn (ReflectionNamedType $t) => $t->getName(), $types),
					true
				);
			}

			$result['ARGUMENTS'][$argName] = [
				'NAME' => $argName,
				'TYPE' => ($isArrayType ? self::ARGUMENT_TYPE_ARRAY : self::ARGUMENT_TYPE_STRING),
				'REQUIRED' => !$optional,
				'DEFAULT_VALUE' => ($optional ? $arg->getDefaultValue() : null),
			];
		}
	}

	return $result;
}

Добавить комментарий