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 Gedcom\Parser; |
||||||
16 | |||||||
17 | class Obje extends \Gedcom\Parser\Component |
||||||
18 | { |
||||||
19 | public static function parse(\Gedcom\Parser $parser) |
||||||
20 | { |
||||||
21 | $record = $parser->getCurrentLineRecord(); |
||||||
22 | $depth = (int) $record[0]; |
||||||
23 | if (isset($record[1])) { |
||||||
24 | $identifier = $parser->normalizeIdentifier($record[1]); |
||||||
25 | } else { |
||||||
26 | $parser->skipToNextLevel($depth); |
||||||
27 | |||||||
28 | return null; |
||||||
29 | } |
||||||
30 | |||||||
31 | $obje = new \Gedcom\Record\Obje(); |
||||||
32 | $obje->setId($identifier); |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
33 | |||||||
34 | $parser->getGedcom()->addObje($obje); |
||||||
35 | |||||||
36 | $parser->forward(); |
||||||
37 | |||||||
38 | while (!$parser->eof()) { |
||||||
39 | $record = $parser->getCurrentLineRecord(); |
||||||
40 | $currentDepth = (int) $record[0]; |
||||||
41 | $recordType = strtoupper(trim($record[1])); |
||||||
42 | |||||||
43 | if ($currentDepth <= $depth) { |
||||||
44 | $parser->back(); |
||||||
45 | break; |
||||||
46 | } |
||||||
47 | |||||||
48 | switch ($recordType) { |
||||||
49 | case 'FILE': |
||||||
50 | $obje->setFile(trim($record[2])); |
||||||
0 ignored issues
–
show
The method
setFile() does not exist on Gedcom\Record\Obje . 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
![]() |
|||||||
51 | break; |
||||||
52 | case 'REFN': |
||||||
53 | $refn = \Gedcom\Parser\Refn::parse($parser); |
||||||
54 | $obje->addRefn($refn); |
||||||
55 | break; |
||||||
56 | case 'RIN': |
||||||
57 | $obje->setRin(trim($record[2])); |
||||||
0 ignored issues
–
show
The method
setRin() does not exist on Gedcom\Record\Obje . 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
![]() |
|||||||
58 | break; |
||||||
59 | |||||||
60 | case 'NOTE': |
||||||
61 | $note = \Gedcom\Parser\NoteRef::parse($parser); |
||||||
62 | if ($note) { |
||||||
63 | $obje->addNote($note); |
||||||
64 | } |
||||||
65 | break; |
||||||
66 | case 'SOUR': |
||||||
67 | |||||||
68 | case 'CHAN': |
||||||
69 | $chan = \Gedcom\Parser\Chan::parse($parser); |
||||||
70 | $obje->setChan($chan); |
||||||
0 ignored issues
–
show
The method
setChan() does not exist on Gedcom\Record\Obje . 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
![]() |
|||||||
71 | break; |
||||||
72 | |||||||
73 | default: |
||||||
74 | $parser->logUnhandledRecord(self::class.' @ '.__LINE__); |
||||||
75 | } |
||||||
76 | |||||||
77 | $parser->forward(); |
||||||
78 | } |
||||||
79 | |||||||
80 | return $obje; |
||||||
81 | } |
||||||
82 | } |
||||||
83 |