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