| Conditions | 5 |
| Paths | 3 |
| Total Lines | 39 |
| Code Lines | 25 |
| 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 | if (isset($record[2])) { |
||
| 24 | $_fone = trim($record[2]); |
||
| 25 | } else { |
||
| 26 | $parser->skipToNextLevel($depth); |
||
| 27 | |||
| 28 | return null; |
||
| 29 | } |
||
| 30 | |||
| 31 | $fone = new \Gedcom\Record\Plac\Fone(); |
||
| 32 | $fone->setPlac($_fone); |
||
|
|
|||
| 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 'TYPE': |
||
| 48 | $fone->setType(trim($record[2])); |
||
| 49 | break; |
||
| 50 | default: |
||
| 51 | $parser->logUnhandledRecord(self::class.' @ '.__LINE__); |
||
| 52 | } |
||
| 53 | |||
| 54 | $parser->forward(); |
||
| 55 | } |
||
| 56 | |||
| 57 | return $fone; |
||
| 58 | } |
||
| 60 |