| Conditions | 8 |
| Paths | 4 |
| 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 | |||
| 24 | $plac = new \PhpGedcom\Record\Indi\Even\Plac(); |
||
| 25 | |||
| 26 | if (isset($record[2])) { |
||
| 27 | $plac->setPlac(trim($record[2])); |
||
| 28 | } |
||
| 29 | |||
| 30 | $parser->forward(); |
||
| 31 | |||
| 32 | while (!$parser->eof()) { |
||
| 33 | $record = $parser->getCurrentLineRecord(); |
||
| 34 | $recordType = strtoupper(trim($record[1])); |
||
| 35 | $currentDepth = (int) $record[0]; |
||
| 36 | |||
| 37 | if ($currentDepth <= $depth) { |
||
| 38 | $parser->back(); |
||
| 39 | break; |
||
| 40 | } |
||
| 41 | |||
| 42 | switch ($recordType) { |
||
| 43 | case 'FORM': |
||
| 44 | $plac->setForm(trim($record[2])); |
||
| 45 | break; |
||
| 46 | case 'NOTE': |
||
| 47 | $note = \PhpGedcom\Parser\NoteRef::parse($parser); |
||
| 48 | if ($note) { |
||
| 49 | $plac->addNote($note); |
||
| 50 | } |
||
| 51 | break; |
||
| 52 | case 'SOUR': |
||
| 53 | $sour = \PhpGedcom\Parser\SourRef::parse($parser); |
||
| 54 | $plac->addSour($sour); |
||
| 55 | break; |
||
| 56 | default: |
||
| 57 | $parser->logUnhandledRecord(get_class().' @ '.__LINE__); |
||
| 58 | } |
||
| 59 | |||
| 60 | $parser->forward(); |
||
| 61 | } |
||
| 62 | |||
| 63 | return $plac; |
||
| 64 | } |
||
| 66 |