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\Indi; |
||||
16 | |||||
17 | class Even |
||||
18 | { |
||||
19 | /** |
||||
20 | * @param int $level |
||||
21 | * |
||||
22 | * @return string |
||||
23 | */ |
||||
24 | public static function convert(\Gedcom\Record\Indi\Even &$even, $level = 0) |
||||
25 | { |
||||
26 | $output = ''; |
||||
27 | |||||
28 | // $_attr; |
||||
29 | $attr = $even->getAttr(); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
30 | if (!empty($attr)) { |
||||
31 | $output .= $level.' EVEN '.$attr."\n"; |
||||
0 ignored issues
–
show
Are you sure
$attr of type Gedcom\Record\Indi\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
![]() |
|||||
32 | } else { |
||||
33 | $output = $level." EVEN\n"; |
||||
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"; |
||||
60 | } |
||||
61 | |||||
62 | // $age; |
||||
63 | $age = $even->getAge(); |
||||
64 | if (!empty($age)) { |
||||
65 | $output .= $level.' AGE '.$age."\n"; |
||||
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"; |
||||
87 | } |
||||
88 | |||||
89 | // $ref = array(); |
||||
90 | // This is not in parser |
||||
91 | |||||
92 | // $obje = array(); |
||||
93 | $obje = $even->getObje(); |
||||
94 | if (!empty($obje) && count($obje) > 0) { |
||||
95 | foreach ($obje as $item) { |
||||
96 | $_convert = \Gedcom\Writer\ObjeRef::convert($item, $level); |
||||
97 | $output .= $_convert; |
||||
98 | } |
||||
99 | } |
||||
100 | // $sour = array(); |
||||
101 | $sour = $even->getSour(); |
||||
102 | if (!empty($sour) && count($sour) > 0) { |
||||
103 | foreach ($sour as $item) { |
||||
104 | $_convert = \Gedcom\Writer\SourRef::convert($item, $level); |
||||
105 | $output .= $_convert; |
||||
106 | } |
||||
107 | } |
||||
108 | // $note = array(); |
||||
109 | $note = $even->getSour(); |
||||
110 | if (!empty($note) && count($note) > 0) { |
||||
111 | foreach ($note as $item) { |
||||
112 | $_convert = \Gedcom\Writer\NoteRef::convert($item, $level); |
||||
113 | $output .= $_convert; |
||||
114 | } |
||||
115 | } |
||||
116 | // Record\Chan |
||||
117 | $chan = $even->getChan(); |
||||
118 | if (!empty($chan)) { |
||||
119 | $_convert = \Gedcom\Writer\Chan::convert($item, $level); |
||||
120 | $output .= $_convert; |
||||
121 | } |
||||
122 | |||||
123 | return $output; |
||||
124 | } |
||||
125 | } |
||||
126 |