Conditions | 5 |
Paths | 7 |
Total Lines | 29 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | public function parseContents($header) |
||
11 | { |
||
12 | $lines = explode(PHP_EOL, $header); |
||
13 | |||
14 | $key = 'label'; |
||
15 | |||
16 | $data = array(); |
||
17 | |||
18 | foreach ($lines as $line) { |
||
19 | if (strpos($line, '@') === 0) { |
||
20 | $tag = strstr($line, ' ', true); |
||
21 | |||
22 | if (!$tag) { |
||
23 | $tag = $line; |
||
24 | } |
||
25 | |||
26 | $key = ltrim($tag, '@'); |
||
27 | |||
28 | $line = ltrim(strstr($line, ' '), ' '); |
||
29 | } |
||
30 | |||
31 | if (!isset($data[$key])) { |
||
32 | $data[$key] = array(); |
||
33 | } |
||
34 | |||
35 | $data[$key][] = $line; |
||
36 | } |
||
37 | |||
38 | return array_diff_key($data, array('')); |
||
39 | } |
||
41 |