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 Xiang Ming <[email protected]> |
||||||
9 | * @copyright Copyright (c) 2010-2013, Xiang Ming |
||||||
10 | * @license MIT |
||||||
11 | * |
||||||
12 | * @link http://github.com/mrkrstphr/php-gedcom |
||||||
13 | */ |
||||||
14 | |||||||
15 | namespace Gedcom\Writer\Fam; |
||||||
16 | |||||||
17 | class Even |
||||||
18 | { |
||||||
19 | /** |
||||||
20 | * @param int $level |
||||||
21 | * |
||||||
22 | * @return string |
||||||
23 | */ |
||||||
24 | public static function convert(\Gedcom\Record\Fam\Even &$even, $level) |
||||||
25 | { |
||||||
26 | $output = ''; |
||||||
27 | |||||||
28 | // $type; |
||||||
29 | $type = $even->getType(); |
||||||
30 | if (!empty($type)) { |
||||||
31 | $output .= $level.' '.$type."\n"; |
||||||
32 | } else { |
||||||
33 | return $output; |
||||||
34 | } |
||||||
35 | $level++; |
||||||
36 | |||||||
37 | // $type; |
||||||
38 | $type = $even->getType(); |
||||||
39 | if (!empty($type)) { |
||||||
40 | $output .= $level.' TYPE '.$type."\n"; |
||||||
41 | } |
||||||
42 | |||||||
43 | // $date; |
||||||
44 | $date = $even->getDate(); |
||||||
45 | if (!empty($date)) { |
||||||
46 | $output .= $level.' DATE '.$date."\n"; |
||||||
47 | } |
||||||
48 | |||||||
49 | // Plac |
||||||
50 | $plac = $even->getPlac(); |
||||||
51 | if (!empty($plac)) { |
||||||
52 | $_convert = \Gedcom\Writer\Indi\Even\Plac::convert($plac, $level); |
||||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
53 | $output .= $_convert; |
||||||
54 | } |
||||||
55 | |||||||
56 | // $caus; |
||||||
57 | $caus = $even->getCaus(); |
||||||
0 ignored issues
–
show
The method
getCaus() 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 | if (!empty($caus)) { |
||||||
59 | $output .= $level.' CAUS '.$caus."\n"; |
||||||
0 ignored issues
–
show
Are you sure
$caus of type Gedcom\Record\Fam\Even|mixed can be used in concatenation ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
60 | } |
||||||
61 | |||||||
62 | // $age; |
||||||
63 | $age = $even->getAge(); |
||||||
0 ignored issues
–
show
The method
getAge() 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...
|
|||||||
64 | if (!empty($age)) { |
||||||
65 | $output .= $level.' AGE '.$age."\n"; |
||||||
0 ignored issues
–
show
Are you sure
$age of type Gedcom\Record\Fam\Even|mixed can be used in concatenation ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
66 | } |
||||||
67 | |||||||
68 | // $addr |
||||||
69 | $addr = $even->getAddr(); |
||||||
0 ignored issues
–
show
The method
getAddr() 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...
|
|||||||
70 | if (!empty($addr)) { |
||||||
71 | $_convert = \Gedcom\Writer\Addr::convert($addr, $level); |
||||||
0 ignored issues
–
show
It seems like
$addr can also be of type Gedcom\Record\Fam\Even ; however, parameter $addr of Gedcom\Writer\Addr::convert() does only seem to accept Gedcom\Record\Addr , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
72 | $output .= $_convert; |
||||||
73 | } |
||||||
74 | |||||||
75 | // $phon = array() |
||||||
76 | $phon = $even->getPhon(); |
||||||
0 ignored issues
–
show
The method
getPhon() 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...
|
|||||||
77 | if (!empty($phon) && count($phon) > 0) { |
||||||
0 ignored issues
–
show
It seems like
$phon can also be of type Gedcom\Record\Fam\Even ; however, parameter $value of count() does only seem to accept Countable|array , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
78 | foreach ($phon as $item) { |
||||||
79 | $_convert = \Gedcom\Writer\Phon::convert($item, $level); |
||||||
80 | $output .= $_convert; |
||||||
81 | } |
||||||
82 | } |
||||||
83 | // $agnc |
||||||
84 | $agnc = $even->getAgnc(); |
||||||
0 ignored issues
–
show
The method
getAgnc() 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...
|
|||||||
85 | if (!empty($agnc)) { |
||||||
86 | $output .= $level.' AGNC '.$agnc."\n"; |
||||||
0 ignored issues
–
show
Are you sure
$agnc of type Gedcom\Record\Fam\Even|mixed can be used in concatenation ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
87 | } |
||||||
88 | |||||||
89 | // HUSB |
||||||
90 | $husb = $even->getHusb(); |
||||||
0 ignored issues
–
show
The method
getHusb() 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...
|
|||||||
91 | if (!empty($husb)) { |
||||||
92 | $_convert = \Gedcom\Writer\Fam\Even\Husb::convert($husb, $level); |
||||||
0 ignored issues
–
show
It seems like
$husb can also be of type Gedcom\Record\Fam\Even ; however, parameter $husb of Gedcom\Writer\Fam\Even\Husb::convert() does only seem to accept Gedcom\Record\Fam\Even\Husb , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
93 | $output .= $_convert; |
||||||
94 | } |
||||||
95 | |||||||
96 | // WIFE |
||||||
97 | $wife = $even->getWife(); |
||||||
0 ignored issues
–
show
The method
getWife() 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...
|
|||||||
98 | if (!empty($wife)) { |
||||||
99 | $_convert = \Gedcom\Writer\Fam\Even\Wife::convert($wife, $level); |
||||||
0 ignored issues
–
show
It seems like
$wife can also be of type Gedcom\Record\Fam\Even ; however, parameter $wife of Gedcom\Writer\Fam\Even\Wife::convert() does only seem to accept Gedcom\Record\Fam\Even\Wife , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
100 | $output .= $_convert; |
||||||
101 | } |
||||||
102 | |||||||
103 | // $ref = array(); |
||||||
104 | // This is not in parser |
||||||
105 | |||||||
106 | // $obje = array(); |
||||||
107 | $obje = $even->getObje(); |
||||||
0 ignored issues
–
show
The method
getObje() 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...
|
|||||||
108 | if (!empty($obje) && count($obje) > 0) { |
||||||
109 | foreach ($obje as $item) { |
||||||
110 | $_convert = \Gedcom\Writer\ObjeRef::convert($item, $level); |
||||||
111 | $output .= $_convert; |
||||||
112 | } |
||||||
113 | } |
||||||
114 | // $sour = array(); |
||||||
115 | $sour = $even->getSour(); |
||||||
0 ignored issues
–
show
The method
getSour() 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...
|
|||||||
116 | if (!empty($sour) && count($sour) > 0) { |
||||||
117 | foreach ($sour as $item) { |
||||||
118 | $_convert = \Gedcom\Writer\SourRef::convert($item, $level); |
||||||
119 | $output .= $_convert; |
||||||
120 | } |
||||||
121 | } |
||||||
122 | // $note = array(); |
||||||
123 | $note = $even->getNote(); |
||||||
0 ignored issues
–
show
The method
getNote() 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...
|
|||||||
124 | if (!empty($note) && count($note) > 0) { |
||||||
125 | foreach ($note as $item) { |
||||||
126 | $_convert = \Gedcom\Writer\NoteRef::convert($item, $level); |
||||||
127 | $output .= $_convert; |
||||||
128 | } |
||||||
129 | } |
||||||
130 | |||||||
131 | return $output; |
||||||
132 | } |
||||||
133 | } |
||||||
134 |