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