• Модуль: pull
  • Путь к файлу: ~/bitrix/modules/pull/lib/push/message/googlemessage.php
  • Класс: BitrixPullPushMessageGoogleMessage
  • Вызов: GoogleMessage::strippedPayload
public function strippedPayload($data): string {
	$jsonPayload = json_encode($data, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE);
	$payloadLength = strlen($jsonPayload);
	if ($payloadLength > self::DEFAULT_PAYLOAD_MAXIMUM_SIZE)
	{
		$text = $this->text;
		$useSenderText = false;
		if(array_key_exists("senderMessage", $this->customProperties))
		{
			$useSenderText = true;
			$text = $this->customProperties["senderMessage"];
		}
		$maxTextLength = $nTextLen = strlen($text) - ($payloadLength - self::DEFAULT_PAYLOAD_MAXIMUM_SIZE);
		if ($maxTextLength <= 0)
		{
			return false;
		}
		while (strlen($text = mb_substr($text, 0, --$nTextLen)) > $maxTextLength) ;
		if($useSenderText)
		{
			$this->setCustomProperty("senderMessage", $text);
		}
		else
		{
			$this->setText($text);
		}


		return $this->getPayload();
	}

	return $jsonPayload;
}