• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/classes/general/taskcomments.php
  • Класс: CTaskComments
  • Вызов: CTaskComments::runRestMethod
static function runRestMethod($executiveUserId, $methodName, $args,
	/** @noinspection PhpUnusedParameterInspection */ $navigation)
{
	static $arManifest = null;
	static $arMethodsMetaInfo = null;

	if ($arManifest === null)
	{
		$arManifest = self::getManifest();
		$arMethodsMetaInfo = $arManifest['REST: available methods'];
	}

	// Check and parse params
	CTaskAssert::assert(isset($arMethodsMetaInfo[$methodName]));
	$arMethodMetaInfo = $arMethodsMetaInfo[$methodName];
	$argsParsed = CTaskRestService::_parseRestParams('ctaskcomments', $methodName, $args);

	$returnValue = null;
	if (isset($arMethodMetaInfo['staticMethod']) && $arMethodMetaInfo['staticMethod'])
	{
		if ($methodName === 'add')
		{
			$occurAsUserId = CTasksTools::getOccurAsUserId();
			if ( ! $occurAsUserId )
				$occurAsUserId = $executiveUserId;

			$taskId          = $argsParsed[0];
			$commentText     = $argsParsed[1];
			$commentAuthorId = $occurAsUserId;
			$returnValue     = self::add($taskId, $commentAuthorId, $commentText);
		}
	}
	else
	{
		$taskId = array_shift($argsParsed);
		$oTask  = self::getInstanceFromPool($taskId, $executiveUserId);
		$returnValue = call_user_func_array(array($oTask, $methodName), $argsParsed);
	}

	return (array($returnValue, null));
}