• Модуль: seo
  • Путь к файлу: ~/bitrix/modules/seo/lib/marketing/adsaudience.php
  • Класс: Bitrix\Seo\Marketing\AdsAudience
  • Вызов: AdsAudience::getClientsProfiles
static function getClientsProfiles(AuthAdapter $authAdapter)
{
	$type = $authAdapter->getType();
	return array_values(array_filter(array_map(function ($item) use ($type) {
		$service = new Service();
		$service->setClientId($item['proxy_client_id']);

		$authAdapter = Service::getAuthAdapter($type);
		$authAdapter->setService($service);

		$account = Service::getAccount($type);
		$account->setService($service);
		$account->getRequest()->setAuthAdapter($authAdapter);

		$profile = $account->getProfileCached();
		if ($profile)
		{
			return $profile;
		}
		else
		{
			// if no profile, then may be auth was removed in service
			$authAdapter->removeAuth();
		}
	}, $authAdapter->getAuthorizedClientsList())));
}