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); |
||||
53 | $output .= $_convert; |
||||
54 | } |
||||
55 | |||||
56 | // $caus; |
||||
57 | $caus = $even->getCaus(); |
||||
58 | if (!empty($caus)) { |
||||
59 | $output .= $level.' CAUS '.$caus."\n"; |
||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
60 | } |
||||
61 | |||||
62 | // $age; |
||||
63 | $age = $even->getAge(); |
||||
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(); |
||||
70 | if (!empty($addr)) { |
||||
71 | $_convert = \Gedcom\Writer\Addr::convert($addr, $level); |
||||
72 | $output .= $_convert; |
||||
73 | } |
||||
74 | |||||
75 | // $phon = array() |
||||
76 | $phon = $even->getPhon(); |
||||
77 | if (!empty($phon) && count($phon) > 0) { |
||||
78 | foreach ($phon as $item) { |
||||
79 | $_convert = \Gedcom\Writer\Phon::convert($item, $level); |
||||
80 | $output .= $_convert; |
||||
81 | } |
||||
82 | } |
||||
83 | // $agnc |
||||
84 | $agnc = $even->getAgnc(); |
||||
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(); |
||||
91 | if (!empty($husb)) { |
||||
92 | $_convert = \Gedcom\Writer\Fam\Even\Husb::convert($husb, $level); |
||||
93 | $output .= $_convert; |
||||
94 | } |
||||
95 | |||||
96 | // WIFE |
||||
97 | $wife = $even->getWife(); |
||||
98 | if (!empty($wife)) { |
||||
99 | $_convert = \Gedcom\Writer\Fam\Even\Wife::convert($wife, $level); |
||||
100 | $output .= $_convert; |
||||
101 | } |
||||
102 | |||||
103 | // $ref = array(); |
||||
104 | // This is not in parser |
||||
105 | |||||
106 | // $obje = array(); |
||||
107 | $obje = $even->getObje(); |
||||
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(); |
||||
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(); |
||||
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 |