You are here

protected function BrowserHtmlDebugTrait::formatHtmlOutputHeaders in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php \Drupal\Tests\BrowserHtmlDebugTrait::formatHtmlOutputHeaders()
  2. 9 core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php \Drupal\Tests\BrowserHtmlDebugTrait::formatHtmlOutputHeaders()

Formats HTTP headers as string for HTML output logging.

Parameters

array[] $headers: Headers that should be formatted.

Return value

string The formatted HTML string.

File

core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php, line 84

Class

BrowserHtmlDebugTrait
Provides the debug functions for browser tests.

Namespace

Drupal\Tests

Code

protected function formatHtmlOutputHeaders(array $headers) {
  $flattened_headers = array_map(function ($header) {
    if (is_array($header)) {
      return implode(';', array_map('trim', $header));
    }
    else {
      return $header;
    }
  }, $headers);
  return '<hr />Headers: <pre>' . Html::escape(var_export($flattened_headers, TRUE)) . '</pre>';
}