PoHeader::parseHeader

private PoHeader::parseHeader($header)

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.

File

core/lib/Drupal/Component/Gettext/PoHeader.php, line 252

Class

PoHeader
Gettext PO header handler.

Namespace

Drupal\Component\Gettext

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;
}
doc_Drupal
2016-10-29 09:34:30
Comments
Leave a Comment

Please login to continue.