1: <?php
2:
3: /**
4: * Jyxo PHP Library
5: *
6: * LICENSE
7: *
8: * This source file is subject to the new BSD license that is bundled
9: * with this package in the file license.txt.
10: * It is also available through the world-wide-web at this URL:
11: * https://github.com/jyxo/php/blob/master/license.txt
12: */
13:
14: namespace Jyxo\Gettext\Parser;
15:
16: /**
17: * Container for PO file headers.
18: *
19: * @category Jyxo
20: * @package Jyxo\Gettext
21: * @subpackage Parser
22: * @copyright Copyright (c) 2005-2011 Jyxo, s.r.o.
23: * @license https://github.com/jyxo/php/blob/master/license.txt
24: * @author Matěj Humpál
25: */
26: class Header
27: {
28: /**
29: * Constructor.
30: *
31: * @param string $items PO file header
32: */
33: public function __construct($items)
34: {
35: $items = explode("\n", $items);
36: foreach ($items as $item) {
37: $item = trim($item, '"');
38: $array = explode(': ', $item);
39: if (!empty($array[0])) {
40: if (!empty($array[1])) {
41: $this->{$array[0]} = $array[1];
42: }
43: }
44: }
45: }
46: }
47: