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