| Conditions | 6 |
| Paths | 3 |
| Total Lines | 40 |
| Code Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | public static function parse(\PhpGedcom\Parser $parser) |
||
| 29 | { |
||
| 30 | $record = $parser->getCurrentLineRecord(); |
||
| 31 | $depth = (int)$record[0]; |
||
| 32 | if(isset($record[2])){ |
||
| 33 | $data = new \PhpGedcom\Record\Head\Sour\Data(); |
||
| 34 | $data->setData(trim($record[2])); |
||
|
|
|||
| 35 | } |
||
| 36 | else{ |
||
| 37 | $parser->skipToNextLevel($depth); |
||
| 38 | return null; |
||
| 39 | } |
||
| 40 | |||
| 41 | $parser->forward(); |
||
| 42 | |||
| 43 | while (!$parser->eof()) { |
||
| 44 | $record = $parser->getCurrentLineRecord(); |
||
| 45 | $recordType = strtoupper(trim($record[1])); |
||
| 46 | $currentDepth = (int)$record[0]; |
||
| 47 | |||
| 48 | if ($currentDepth <= $depth) { |
||
| 49 | $parser->back(); |
||
| 50 | break; |
||
| 51 | } |
||
| 52 | |||
| 53 | switch ($recordType) { |
||
| 54 | case 'DATE': |
||
| 55 | $data->setDate(trim($record[2])); |
||
| 56 | break; |
||
| 57 | case 'COPR': |
||
| 58 | $data->setCopr(trim($record[2])); |
||
| 59 | break; |
||
| 60 | default: |
||
| 61 | $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); |
||
| 62 | } |
||
| 63 | |||
| 64 | $parser->forward(); |
||
| 65 | } |
||
| 66 | |||
| 67 | return $data; |
||
| 68 | } |
||
| 70 |