Conditions | 6 |
Paths | 4 |
Total Lines | 37 |
Code Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public static function parse(\Gedcom\Parser $parser) |
||
20 | { |
||
21 | $repo = new \Gedcom\Record\Sour\Repo(); |
||
22 | $record = $parser->getCurrentLineRecord(); |
||
23 | $depth = (int) $record[0]; |
||
24 | if (isset($record[2])) { |
||
25 | $_repo = $parser->normalizeIdentifier($record[2]); |
||
26 | $repo->setRepo($_repo); |
||
|
|||
27 | } |
||
28 | |||
29 | $parser->forward(); |
||
30 | |||
31 | while (!$parser->eof()) { |
||
32 | $record = $parser->getCurrentLineRecord(); |
||
33 | $recordType = strtoupper(trim($record[1])); |
||
34 | $currentDepth = (int) $record[0]; |
||
35 | |||
36 | if ($currentDepth <= $depth) { |
||
37 | $parser->back(); |
||
38 | break; |
||
39 | } |
||
40 | |||
41 | switch ($recordType) { |
||
42 | case 'NOTE': |
||
43 | $repo->addNote(\Gedcom\Parser\NoteRef::parse($parser)); |
||
44 | break; |
||
45 | case 'CALN': |
||
46 | $repo->addCaln(\Gedcom\Parser\Sour\Repo\Caln::parse($parser)); |
||
47 | break; |
||
48 | default: |
||
49 | $parser->logUnhandledRecord(self::class.' @ '.__LINE__); |
||
50 | } |
||
51 | |||
52 | $parser->forward(); |
||
53 | } |
||
54 | |||
55 | return $repo; |
||
56 | } |
||
58 |