You are here

public static function HTMLMailMime::concat in HTML Mail 8

Same name and namespace in other branches
  1. 8.3 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 636
Provides the MailMIME class for creating MIME-formatted email messages.

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;
}