Conditions | 5 |
Paths | 3 |
Total Lines | 39 |
Code Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public static function parse(\PhpGedcom\Parser $parser) |
||
20 | { |
||
21 | $record = $parser->getCurrentLineRecord(); |
||
22 | $depth = (int) $record[0]; |
||
23 | if (isset($record[2])) { |
||
24 | $_stat = $record[2]; |
||
25 | } else { |
||
26 | $parser->skipToNextLevel($depth); |
||
27 | |||
28 | return null; |
||
29 | } |
||
30 | |||
31 | $stat = new \PhpGedcom\Record\Fam\Slgs\Stat(); |
||
32 | $stat->setStat($_stat); |
||
|
|||
33 | |||
34 | $parser->forward(); |
||
35 | |||
36 | while (!$parser->eof()) { |
||
37 | $record = $parser->getCurrentLineRecord(); |
||
38 | $recordType = strtoupper(trim($record[1])); |
||
39 | $currentDepth = (int) $record[0]; |
||
40 | |||
41 | if ($currentDepth <= $depth) { |
||
42 | $parser->back(); |
||
43 | break; |
||
44 | } |
||
45 | |||
46 | switch ($recordType) { |
||
47 | case 'DATE': |
||
48 | $stat->setDate(trim($record[2])); |
||
49 | break; |
||
50 | default: |
||
51 | $parser->logUnhandledRecord(get_class().' @ '.__LINE__); |
||
52 | } |
||
53 | |||
54 | $parser->forward(); |
||
55 | } |
||
56 | |||
57 | return $stat; |
||
58 | } |
||
60 |