1 | <?php |
||||||
2 | /** |
||||||
3 | * php-gedcom. |
||||||
4 | * |
||||||
5 | * php-gedcom is a library for parsing, manipulating, importing and exporting |
||||||
6 | * GEDCOM 5.5 files in PHP 5.3+. |
||||||
7 | * |
||||||
8 | * @author Kristopher Wilson <[email protected]> |
||||||
9 | * @copyright Copyright (c) 2010-2013, Kristopher Wilson |
||||||
10 | * @license MIT |
||||||
11 | * |
||||||
12 | * @link http://github.com/mrkrstphr/php-gedcom |
||||||
13 | */ |
||||||
14 | |||||||
15 | namespace PhpGedcom\Parser; |
||||||
16 | |||||||
17 | class RepoRef extends \PhpGedcom\Parser\Component |
||||||
18 | { |
||||||
19 | public static function parse(\PhpGedcom\Parser $parser) |
||||||
20 | { |
||||||
21 | $record = $parser->getCurrentLineRecord(); |
||||||
22 | $depth = (int) $record[0]; |
||||||
23 | if (isset($record[2])) { |
||||||
24 | $identifier = $parser->normalizeIdentifier($record[2]); |
||||||
25 | } else { |
||||||
26 | $parser->skipToNextLevel($depth); |
||||||
27 | |||||||
28 | return null; |
||||||
29 | } |
||||||
30 | |||||||
31 | $repo = new \PhpGedcom\Record\RepoRef(); |
||||||
32 | $repo->setRepo($identifier); |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
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 'CALN': |
||||||
48 | $repo->addCaln(\PhpGedcom\Parser\Caln::parse($parser)); |
||||||
0 ignored issues
–
show
The method
addCaln() does not exist on PhpGedcom\Record\RepoRef . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
49 | break; |
||||||
50 | case 'NOTE': |
||||||
51 | $note = \PhpGedcom\Parser\NoteRef::parse($parser); |
||||||
52 | if ($note) { |
||||||
53 | $repo->addNote($note); |
||||||
54 | } |
||||||
55 | break; |
||||||
56 | default: |
||||||
57 | $parser->logUnhandledRecord(get_class().' @ '.__LINE__); |
||||||
58 | } |
||||||
59 | |||||||
60 | $parser->forward(); |
||||||
61 | } |
||||||
62 | |||||||
63 | return $repo; |
||||||
64 | } |
||||||
65 | } |
||||||
66 |