Transform textcard message.

@return array
18722
public function transformTextCard(AbstractMessage $message)
    {
        return [
            'msgtype'  => 'textcard',
            'textcard' => [
                'title'       => $message->get('title'),
                'description' => $message->get('description'),
                'url'         => $message->get('url'),
                'btntxt'      => $message->get('btntxt'),
            ],
        ];
    }
1188406
public function textMessages()
    {
        $result = [];
        foreach ($this->entries as $entry) {
            foreach ($entry->messages as $entryMessage) {
                if ($entryMessage->isMessage) {
                    if ($entryMessage->message->isText && !$entryMessage->message->isQuickReply) {
                        $result[] = $entryMessage;
                    }
                }
            }
        }
        return collect($result);
    }
758480
public function toiOS()
    {
        $message = [
            'apns' => [
                'aps' => [
                    'alert' => [
                        'title' => $this->title,
                        'body' => $this->body,
                    ],
                    'sound' => $this->sound,
                    'badge' => $this->badge,
                ],
            ],
        ];

        $this->formatMessage($message);

        return $message;
    }
434590
public function transform(Template $message)
    {
        return array_merge([
            'template_type' => 'list',
            'top_element_style' => $message->getTopStyle(),
            'elements' => $message->getCollections()->toData(),
        ], $message->getButton() !== null ? ['buttons' => [$message->getButton()->toData()]] : []);
    }
988619
public function transform($data)
    {
        if (empty($data))
            return null;

        $data = array_merge(array(
            'id' => null,
            "sender" => null,
            "recipients" => array(),
            "subject" => null,
            "source" => null,
            "size" => null,
            "type" => null,
            "created_at" => null,
            "formats" => array()
        ), $data);

        $data['created_at'] = $data['created_at'] === null ? null : new \DateTime($data['created_at']);
        $data['sender'] = $data['sender'] === null ? null : $this->addressTransformer->transform($data['sender']);

        $recipients = array();
        foreach ($data['recipients'] as $recipient) {
            $recipients[] = $this->addressTransformer->transform($recipient);
        }
        $data['recipients'] = $recipients;

        return new Message($data);
    }
586033
protected function genericMessageToArray()
    {
        $message = [];
        $message['recipient'] = $this->recipient;
        $message['notification_type'] = $this->notificationType;
        $message['message']['attachment']['type'] = 'template';
        $message['message']['attachment']['payload']['template_type'] = 'generic';
        $message['message']['attachment']['payload']['elements'] = $this->cards;

        return $message;
    }
671512
public static function applyformatToText() {
    $args = func_get_args();
    $count = func_num_args();

    $text = $args[$count - 1];
    if ($count == 1) { return $text; }

    $mode_texts = array_slice($args, 0, $count - 1);

    return self::buildEscapeCodes($mode_texts).$text.self::buildEscapeCodes('plain');
  }
284506
public function getMessageFormat() {
		$message = ['msg_type' => $this->msg_type];
		switch($this->msg_type) {
			case 'text':
				$message['content'] = $this->content;
				break;
			case 'video':
				$message['title'] = $this->title;
				$message['description'] = $this->description;
			case 'image':
			case 'voice':
				$message['media_id'] = $this->materialMedia->media_id;
				$message['media_url'] = $this->materialMedia->material->url;
				break;
			case 'music':
				$message['title'] = $this->title;
				$message['description'] = $this->description;
				$message['music_url'] = $this->music_url;
				$message['hq_music_url'] = $this->hq_music_url;
				$message['thumb_media_id'] = $this->thumbMaterialMedia->media_id;
				$message['thumb_media_url'] = $this->thumbMaterialMedia->material->url;
				break;
			case 'news':
				$pic_urls = $this->newsMedia->thumbUrlList;
				$urls = $this->newsMedia->urlList;
				$articles = [];
				foreach($this->newsMedia->news->items as $index => $item) {
					if(!isset($pic_urls[$index]) || !isset($urls[$index])) {
						break;
					}
					$articles[] = [
						'title' => $item->title,
						'description' => $item->digest,
						'pic_url' => $pic_urls[$index],
						'url' => $urls[$index],
					];
				}
				$message['articles'] = Json::encode($articles);
				break;
			default:
				return [];
				break;
		}

		return $message;
	}
123844
public function toText()
	{
		$text = '';
		
		// if this group is not a destination
		if ( ! $this->isDestination()) {
			foreach ($this->children as $child) {
				$text .= $child->format('text');
			}
		}
		
		return $text;
	}
1096912
public function getSchemaMessage()
    {
        $message = $this->getMessage();
        if (!$message) {
            return null;
        }
        // Form schema messages treat simple strings as plain text, so nest for html messages
        if ($this->getMessageCast() === ValidationResult::CAST_HTML) {
            $message = ['html' => $message];
        }
        return [
            'value' => $message,
            'type' => $this->getMessageType(),
        ];
    }
1173934
public function getTransformations()
    {
        $result = [];
        foreach ($this as $template) {
            foreach ($template as $transformation) {
                $result[] = $transformation;
            }
        }

        return $result;
    }
719604
private function processAllMessages()
    { 
        $processed = [];

        $receivers = $this->receivers();

        $messages = $this->manager->getMessages();
        
        foreach ($receivers as $receiver)
        {   
            foreach ($messages as $index => $message)
            {                
                $this->composition($receiver, $message);

                $id = $this->sendMessage($receiver, $message);

                $copy = new stdClass();
                $copy->id = $id;
                $copy->type = $message->type;
                $copy->sender = $this->account['number'];
                $copy->nickname = $this->account['nickname'];
                $copy->to = implode(', ', (array) $receiver);

                $copy->message = $message;

                if(isset($message->file) && !$message->hash)
                {
                    $copy->message->hash = $messages[$index]->hash = base64_encode(hash_file("sha256", $message->file, true));
                }

                foreach ($this->manager->getInjectedVars() as $key => $value)
                {
                    $copy->$key = $value;
                }

                $processed[] = $copy;
            }
        }

        $this->broadcast = false;

        $this->manager->clear();

        return $processed;
    }
869446
public function attachmentMessages()
    {
        $result = [];
        foreach ($this->entries as $entry) {
            foreach ($entry->messages as $entryMessage) {
                if ($entryMessage->isMessage) {
                    if ($entryMessage->message->hasAttachments) {
                        $result[] = $entryMessage->message;
                    }
                }
            }
        }
        return collect($result);
    }
1319707
public function getMessages()
    {
        $messages = array();
        foreach ($this->_fields as $fieldName => $values) {
            if (! $values['isValid']) {
                $invalidators = array();
                foreach ($values['validators'] as $validatorName => $validatorValue) {
                    if (! $validatorValue) {
                        $invalidators[] = $validatorName;
                    }
                }
                $messages[$fieldName] = $invalidators;
                unset($validator);
            }
            unset($fieldName);
            unset($values);
        }
        return $messages;
    }
479738
private function _getTransforms(): array
    {
        if (!$this->availableTransforms) {
            return [];
        }

        $allTransforms = Craft::$app->getAssetTransforms()->getAllTransforms();
        $transformList = [];

        foreach ($allTransforms as $transform) {
            if (!is_array($this->availableTransforms) || in_array($transform->uid, $this->availableTransforms, false)) {
                $transformList[] = [
                    'handle' => Html::encode($transform->handle),
                    'name' => Html::encode($transform->name)
                ];
            }
        }

        return $transformList;
    }
82574
protected function loadMessages()
    {
        $messages = Collection::make($this->event->get('messaging'))->filter(function ($msg) {
            return isset($msg['message']) && isset($msg['message']['attachments']) && isset($msg['message']['attachments']);
        })->transform(function ($msg) {
            $message = new IncomingMessage(Image::PATTERN, $msg['sender']['id'], $msg['recipient']['id'], $msg);
            $message->setImages($this->getImagesUrls($msg));

            return $message;
        })->toArray();

        if (count($messages) === 0) {
            $messages = [new IncomingMessage('', '', '')];
        }

        $this->messages = $messages;
    }
284150
public function getMessages()
    {
        $messages = parent::getMessages();

        foreach ($this->children as $child) {
            $messages = array_merge($messages, $child->getMessages());
        }

        return $messages;
    }