| Conditions | 5 |
| Paths | 3 |
| Total Lines | 36 |
| Code Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public static function parse(\PhpGedcom\Parser $parser) |
||
| 20 | { |
||
| 21 | $caln = new \PhpGedcom\Record\Sour\Repo\Caln(); |
||
| 22 | $record = $parser->getCurrentLineRecord(); |
||
| 23 | $depth = (int) $record[0]; |
||
| 24 | if (isset($record[2])) { |
||
| 25 | $_caln = $record[2]; |
||
| 26 | $caln->setCaln($_caln); |
||
|
|
|||
| 27 | } else { |
||
| 28 | return null; |
||
| 29 | } |
||
| 30 | |||
| 31 | $parser->forward(); |
||
| 32 | |||
| 33 | while (!$parser->eof()) { |
||
| 34 | $record = $parser->getCurrentLineRecord(); |
||
| 35 | $recordType = strtoupper(trim($record[1])); |
||
| 36 | $currentDepth = (int) $record[0]; |
||
| 37 | |||
| 38 | if ($currentDepth <= $depth) { |
||
| 39 | $parser->back(); |
||
| 40 | break; |
||
| 41 | } |
||
| 42 | |||
| 43 | switch ($recordType) { |
||
| 44 | case 'MEDI': |
||
| 45 | $caln->setMedi(trim($record[2])); |
||
| 46 | break; |
||
| 47 | default: |
||
| 48 | $parser->logUnhandledRecord(get_class().' @ '.__LINE__); |
||
| 49 | } |
||
| 50 | |||
| 51 | $parser->forward(); |
||
| 52 | } |
||
| 53 | |||
| 54 | return $caln; |
||
| 55 | } |
||
| 57 |