• Модуль: seo
  • Путь к файлу: ~/bitrix/modules/seo/lib/engine/yandexdirect.php
  • Класс: BitrixSeoEngineYandexDirect
  • Вызов: YandexDirect::getCampaign
public function getCampaign($campaignsId)
{
	if (empty($campaignsId))
	{
		throw new ArgumentNullException("campaignId");
	}
	
	if (!is_array($campaignsId))
	{
		$campaignsId = array($campaignsId);
	}
	
	$offset = 0;
	
	$result = array();
	
	while ($offset < count($campaignsId))
	{
		$currentCampaigns = array_slice($campaignsId, $offset, static::CAMPAIGN_LIMIT);
		
		$currentResult = $this->getProxy()->getInterface()->getCampaign(static::ENGINE_ID, $currentCampaigns);
		
		if (!empty($currentResult['error']))
		{
			throw new YandexDirectException($currentResult);
		}
		
		$result = array_merge($result, $currentResult);
		
		$offset += static::CAMPAIGN_LIMIT;
	}
	
	return $result;
}