| Conditions | 6 |
| Paths | 3 |
| Total Lines | 44 |
| Code Lines | 27 |
| 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 | |||
| 24 | if (count($record) < 3) { |
||
|
|
|||
| 25 | $parser->logSkippedRecord('Missing family information; '.get_class(), ' @ '.__LINE__); |
||
| 26 | $parser->skipToNextLevel($depth); |
||
| 27 | |||
| 28 | return null; |
||
| 29 | } |
||
| 30 | |||
| 31 | $fams = $parser->normalizeIdentifier($record[2]); |
||
| 32 | |||
| 33 | $fam = new \PhpGedcom\Record\Indi\Fams(); |
||
| 34 | $fam->setFams($fams); |
||
| 35 | |||
| 36 | $parser->forward(); |
||
| 37 | |||
| 38 | while (!$parser->eof()) { |
||
| 39 | $record = $parser->getCurrentLineRecord(); |
||
| 40 | $recordType = strtoupper(trim($record[1])); |
||
| 41 | $currentDepth = (int) $record[0]; |
||
| 42 | |||
| 43 | if ($currentDepth <= $depth) { |
||
| 44 | $parser->back(); |
||
| 45 | break; |
||
| 46 | } |
||
| 47 | |||
| 48 | switch ($recordType) { |
||
| 49 | case 'NOTE': |
||
| 50 | $note = \PhpGedcom\Parser\NoteRef::parse($parser); |
||
| 51 | if ($note) { |
||
| 52 | $fam->addNote($note); |
||
| 53 | } |
||
| 54 | break; |
||
| 55 | default: |
||
| 56 | $parser->logUnhandledRecord(get_class().' @ '.__LINE__); |
||
| 57 | } |
||
| 58 | |||
| 59 | $parser->forward(); |
||
| 60 | } |
||
| 61 | |||
| 62 | return $fam; |
||
| 63 | } |
||
| 65 |