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\Fam; |
||||||
16 | |||||||
17 | class Even extends \Gedcom\Parser\Component |
||||||
18 | { |
||||||
19 | public static function parse(\Gedcom\Parser $parser) |
||||||
20 | { |
||||||
21 | $record = $parser->getCurrentLineRecord(); |
||||||
22 | $depth = (int) $record[0]; |
||||||
23 | |||||||
24 | $even = new \Gedcom\Record\Fam\Even(); |
||||||
25 | |||||||
26 | if (isset($record[1]) && strtoupper(trim($record[1])) != 'EVEN') { |
||||||
27 | $even->setType(trim($record[1])); |
||||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
28 | } |
||||||
29 | |||||||
30 | $parser->forward(); |
||||||
31 | |||||||
32 | while (!$parser->eof()) { |
||||||
33 | $record = $parser->getCurrentLineRecord(); |
||||||
34 | $recordType = strtoupper(trim($record[1])); |
||||||
35 | $currentDepth = (int) $record[0]; |
||||||
36 | |||||||
37 | if ($currentDepth <= $depth) { |
||||||
38 | $parser->back(); |
||||||
39 | break; |
||||||
40 | } |
||||||
41 | |||||||
42 | switch ($recordType) { |
||||||
43 | case 'TYPE': |
||||||
44 | $even->setType(trim($record[2])); |
||||||
45 | break; |
||||||
46 | case 'DATE': |
||||||
47 | $dat = \Gedcom\Parser\Date::parse($parser); |
||||||
48 | $even->setDate($dat); |
||||||
0 ignored issues
–
show
The method
setDate() does not exist on Gedcom\Record\Fam\Even . 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
Loading history...
|
|||||||
49 | //$even->setDate(trim($record[2])); |
||||||
50 | break; |
||||||
51 | case 'PLAC': |
||||||
52 | $plac = \Gedcom\Parser\Plac::parse($parser); |
||||||
53 | $even->setPlac($plac); |
||||||
0 ignored issues
–
show
The method
setPlac() does not exist on Gedcom\Record\Fam\Even . 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
Loading history...
|
|||||||
54 | break; |
||||||
55 | case 'ADDR': |
||||||
56 | $addr = \Gedcom\Parser\Addr::parse($parser); |
||||||
57 | $even->setAddr($addr); |
||||||
0 ignored issues
–
show
The method
setAddr() does not exist on Gedcom\Record\Fam\Even . 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
Loading history...
|
|||||||
58 | break; |
||||||
59 | case 'PHON': |
||||||
60 | $phone = \Gedcom\Parser\Phon::parse($parser); |
||||||
61 | $even->addPhone($phone); |
||||||
0 ignored issues
–
show
The method
addPhone() does not exist on Gedcom\Record\Fam\Even . 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
Loading history...
|
|||||||
62 | break; |
||||||
63 | case 'CAUS': |
||||||
64 | $even->setCaus(trim($record[2])); |
||||||
0 ignored issues
–
show
The method
setCaus() does not exist on Gedcom\Record\Fam\Even . 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
Loading history...
|
|||||||
65 | break; |
||||||
66 | case 'AGE': |
||||||
67 | $even->setAge(trim($record[2])); |
||||||
0 ignored issues
–
show
The method
setAge() does not exist on Gedcom\Record\Fam\Even . 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
Loading history...
|
|||||||
68 | break; |
||||||
69 | case 'AGNC': |
||||||
70 | $even->setAgnc(trim($record[2])); |
||||||
0 ignored issues
–
show
The method
setAgnc() does not exist on Gedcom\Record\Fam\Even . 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
Loading history...
|
|||||||
71 | break; |
||||||
72 | case 'HUSB': |
||||||
73 | $husb = \Gedcom\Parser\Fam\Even\Husb::parse($parser); |
||||||
74 | $even->setHusb($husb); |
||||||
0 ignored issues
–
show
The method
setHusb() does not exist on Gedcom\Record\Fam\Even . 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
Loading history...
|
|||||||
75 | break; |
||||||
76 | case 'WIFE': |
||||||
77 | $wife = \Gedcom\Parser\Fam\Even\Wife::parse($parser); |
||||||
78 | $even->setWife($wife); |
||||||
0 ignored issues
–
show
The method
setWife() does not exist on Gedcom\Record\Fam\Even . 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
Loading history...
|
|||||||
79 | break; |
||||||
80 | case 'SOUR': |
||||||
81 | $sour = \Gedcom\Parser\SourRef::parse($parser); |
||||||
82 | $even->addSour($sour); |
||||||
83 | break; |
||||||
84 | case 'OBJE': |
||||||
85 | $obje = \Gedcom\Parser\ObjeRef::parse($parser); |
||||||
86 | $even->addObje($obje); |
||||||
87 | break; |
||||||
88 | case 'NOTE': |
||||||
89 | $note = \Gedcom\Parser\NoteRef::parse($parser); |
||||||
90 | if ($note) { |
||||||
91 | $even->addNote($note); |
||||||
92 | } |
||||||
93 | break; |
||||||
94 | default: |
||||||
95 | $parser->logUnhandledRecord(self::class.' @ '.__LINE__); |
||||||
96 | } |
||||||
97 | |||||||
98 | $parser->forward(); |
||||||
99 | } |
||||||
100 | |||||||
101 | return $even; |
||||||
102 | } |
||||||
103 | } |
||||||
104 |