You are here

public static function HtmlMailMime::concat in HTML Mail 8.3

Same name and namespace in other branches
  1. 8 src/Utility/HTMLMailMime.php \Drupal\htmlmail\Utility\HTMLMailMime::concat()

Collapses a message array into a single string.

Also, standardizes the line-ending character.

Parameters

array|string $data: The original message array or string.

string $eol: The end of line characters.

Return value

string The collapsed message string.

2 calls to HtmlMailMime::concat()
HtmlMailMime::encodeEmail in src/Utility/HtmlMailMime.php
Convert message headers and body into an encoded string.
HtmlMailSystem::formatMailMime in src/Plugin/Mail/HtmlMailSystem.php
Use the MailMime class to format the message body.

File

src/Utility/HtmlMailMime.php, line 646

Class

HtmlMailMime
Class HtmlMailMime.

Namespace

Drupal\htmlmail\Utility

Code

public static function concat($data, $eol) {
  $data = preg_replace('/(\\r|\\r\\n|\\n)/', $eol, $data);
  if (is_array($data)) {
    $data = implode($eol, $data);
  }
  return $data;
}