| Conditions | 9 |
| Paths | 2 |
| Total Lines | 46 |
| Code Lines | 33 |
| 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 | $data = new \Gedcom\Record\Sour\Data(); |
||
| 25 | |||
| 26 | $parser->forward(); |
||
| 27 | |||
| 28 | while (!$parser->eof()) { |
||
| 29 | $record = $parser->getCurrentLineRecord(); |
||
| 30 | $recordType = strtoupper(trim($record[1])); |
||
| 31 | $currentDepth = (int) $record[0]; |
||
| 32 | |||
| 33 | if ($currentDepth <= $depth) { |
||
| 34 | $parser->back(); |
||
| 35 | break; |
||
| 36 | } |
||
| 37 | |||
| 38 | switch ($recordType) { |
||
| 39 | case 'EVEN': |
||
| 40 | $data->addEven(\Gedcom\Parser\Sour\Data\Even::parse($parser)); |
||
|
|
|||
| 41 | break; |
||
| 42 | case 'DATE': // not in 5.5.1 |
||
| 43 | $data->setDate(trim($record[2])); |
||
| 44 | break; |
||
| 45 | case 'AGNC': |
||
| 46 | $data->setAgnc(trim($record[2])); |
||
| 47 | break; |
||
| 48 | case 'NOTE': |
||
| 49 | $note = \Gedcom\Parser\NoteRef::parse($parser); |
||
| 50 | if ($note) { |
||
| 51 | $data->addNote($note); |
||
| 52 | } |
||
| 53 | break; |
||
| 54 | case 'TEXT': // not in 5.5.1 |
||
| 55 | $data->setText($parser->parseMultiLineRecord()); |
||
| 56 | break; |
||
| 57 | default: |
||
| 58 | $parser->logUnhandledRecord(self::class.' @ '.__LINE__); |
||
| 59 | } |
||
| 60 | |||
| 61 | $parser->forward(); |
||
| 62 | } |
||
| 63 | |||
| 64 | return $data; |
||
| 65 | } |
||
| 67 |