• Модуль: socialservices
  • Путь к файлу: ~/bitrix/modules/socialservices/classes/general/google.php
  • Класс: CSocServGoogleOAuth
  • Вызов: CSocServGoogleOAuth::getFriendsList
public function getFriendsList($limit, &$next)
{
	$res = array();

	if($this->getEntityOAuth()->GetAccessToken() !== false)
	{
		$res = $this->getEntityOAuth()->getCurrentUserFriends($limit, $next);

		foreach($res as $key => $contact)
		{
			$contact['uid'] = $contact['email'];

			$arName = $contact['name'];

			$contact['first_name'] = trim($arName['givenName']);
			$contact['last_name'] = trim($arName['familyName']);
			$contact['second_name'] = trim($arName['additionalName']);

			if(!$contact['first_name'] && !$contact['last_name'])
			{
				$contact['first_name'] = $contact['uid'];
			}

			$res[$key] = $contact;
		}
	}

	return $res;
}