You are here

private function PoHeader::parseHeader in Localization update 7.2

Parses a Gettext Portable Object file header.

Parameters

string $header: A string containing the complete header.

Return value

array An associative array of key-value pairs.

1 call to PoHeader::parseHeader()
PoHeader::setFromString in includes/gettext/PoHeader.php
Populate internal values from a string.

File

includes/gettext/PoHeader.php, line 238
Definition of Drupal\Component\Gettext\PoHeader.

Class

PoHeader
Gettext PO header handler.

Code

private function parseHeader($header) {
  $header_parsed = array();
  $lines = array_map('trim', explode("\n", $header));
  foreach ($lines as $line) {
    if ($line) {
      list($tag, $contents) = explode(":", $line, 2);
      $header_parsed[trim($tag)] = trim($contents);
    }
  }
  return $header_parsed;
}