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