• Модуль: transformer
  • Путь к файлу: ~/bitrix/modules/transformer/lib/command.php
  • Класс: BitrixTransformerCommand
  • Вызов: Command::callback
public function callback($result = array())
{
	if(!is_array($this->module))
	{
		$this->module = array($this->module);
	}

	if(!is_array($this->callback))
	{
		$this->callback = array($this->callback);
	}

	foreach($this->module as $module)
	{
		if(!BitrixMainLoader::includeModule($module))
		{
			Log::write('callback cant load module '.$module);
			return false;
		}
	}
	$count = count($this->callback);
	$success = 0;
	$result['command'] = $this;
	foreach($this->callback as $callback)
	{
		if(is_a($callback, 'BitrixTransformerInterfaceCallback', true))
		{
			try
			{
				/* @var $callback InterfaceCallback*/
				$resultCallback = $callback::call($this->status, $this->command, $this->params, $result);
			}
			catch(Exception $exception)
			{
				$resultCallback = $exception->getMessage();
			}
			catch (Error $error)
			{
				$resultCallback = $error->getMessage();
			}
			if($resultCallback === true)
			{
				$success++;
			}
			else
			{
				Log::write('Error doing callback. Result: '.$resultCallback);
			}
		}
		else
		{
			Log::write($callback.' does not implements BitrixTransformerInterfaceCallback');
		}
	}
	return ($count == $success);
}