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