1 | <?php |
||
18 | class PoHeader extends PoEntry |
||
19 | { |
||
20 | protected $structuredHeaders = null; |
||
21 | |||
22 | |||
23 | /** |
||
24 | * Create an empty header entry |
||
25 | */ |
||
26 | 16 | public function __construct() |
|
31 | |||
32 | /** |
||
33 | * Populate the internal structuredHeaders property with contents |
||
34 | * of this entry's "msgstr" value. |
||
35 | * |
||
36 | * @return void |
||
37 | */ |
||
38 | 10 | protected function buildStructuredHeaders(): void |
|
56 | |||
57 | /** |
||
58 | * Rebuild the this entry's "msgstr" value using contents of the internal |
||
59 | * structuredHeaders property. |
||
60 | * |
||
61 | * @return boolean true if rebuilt, false if not |
||
62 | */ |
||
63 | 9 | protected function storeStructuredHeader(): bool |
|
76 | |||
77 | /** |
||
78 | * Get a header value string by key |
||
79 | * |
||
80 | * @param string $key case insensitive name of header to return |
||
81 | * |
||
82 | * @return string|null header string for key or false if not set |
||
83 | */ |
||
84 | 5 | public function getHeader(string $key): ?string |
|
94 | |||
95 | /** |
||
96 | * Set the value of a header string for a key. |
||
97 | * |
||
98 | * @param string $key name of header to set. If the header exists, the name is |
||
99 | * case insensitive. If it is new the given case will be used |
||
100 | * @param string $value value to set |
||
101 | * |
||
102 | * @return void |
||
103 | */ |
||
104 | 9 | public function setHeader(string $key, string $value): void |
|
116 | |||
117 | /** |
||
118 | * Set the POT-Creation-Date header |
||
119 | * |
||
120 | * @param integer|null $time unix timestamp, null to use current |
||
121 | * |
||
122 | * @return void |
||
123 | */ |
||
124 | 9 | public function setCreateDate(?int $time = null): void |
|
128 | |||
129 | /** |
||
130 | * Set the PO-Revision-Date header |
||
131 | * |
||
132 | * @param integer|null $time unix timestamp, null to use current |
||
133 | * |
||
134 | * @return void |
||
135 | */ |
||
136 | 1 | public function setRevisionDate(?int $time = null): void |
|
140 | |||
141 | /** |
||
142 | * Format a timestamp following PO file conventions |
||
143 | * |
||
144 | * @param integer|null $time unix timestamp, null to use current |
||
145 | * |
||
146 | * @return string formatted timestamp |
||
147 | */ |
||
148 | 9 | protected function formatTimestamp(?int $time = null): string |
|
155 | |||
156 | /** |
||
157 | * Create a default header entry |
||
158 | * |
||
159 | * @return void |
||
160 | */ |
||
161 | 9 | public function buildDefaultHeader(): void |
|
182 | |||
183 | /** |
||
184 | * Dump this entry as a po/pot file fragment |
||
185 | * |
||
186 | * @return string |
||
187 | */ |
||
188 | 6 | public function dumpEntry(): string |
|
193 | } |
||
194 |