@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public function store(Request $request) |
21 | 21 | { |
22 | - if($request->hasFile('file')){ |
|
22 | + if ($request->hasFile('file')) { |
|
23 | 23 | if ($request->file('file')->isValid()) { |
24 | 24 | $request->file->storeAs('gedcom', 'file.ged'); |
25 | 25 | $this->readData(); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | - private function get_Person($individual){ |
|
56 | + private function get_Person($individual) { |
|
57 | 57 | $g_id = $individual->getId(); |
58 | 58 | $surn = current($individual->getName())->getSurn(); |
59 | 59 | $givn = current($individual->getName())->getGivn(); |
@@ -63,17 +63,17 @@ discard block |
||
63 | 63 | $events = $individual->getEven(); |
64 | 64 | $media = $individual->getObje(); |
65 | 65 | |
66 | - if($givn == "") { |
|
66 | + if ($givn == "") { |
|
67 | 67 | $givn = $name; |
68 | 68 | } |
69 | 69 | |
70 | 70 | $sex = $sex === 'F' ? 'female' : 'male'; |
71 | 71 | $surn = isset($surn) ? $surn : 'No Surname'; |
72 | 72 | |
73 | - foreach($events as $event){ |
|
73 | + foreach ($events as $event) { |
|
74 | 74 | $date = $this->get_date($event->getDate()); |
75 | 75 | $place = $this->get_place($event->getPlac()); |
76 | - if(isset($date) || isset($place)){ |
|
76 | + if (isset($date) || isset($place)) { |
|
77 | 77 | $place = isset($place) ? $place : 'No place'; |
78 | 78 | Event::create([ |
79 | 79 | 'event_type' => 'App\Individual', |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | } |
87 | 87 | }; |
88 | 88 | |
89 | - foreach($attr as $event){ |
|
89 | + foreach ($attr as $event) { |
|
90 | 90 | $date = $this->get_date($event->getDate()); |
91 | 91 | $place = $this->get_place($event->getPlac()); |
92 | - if(count($event->getNote())>0){ |
|
92 | + if (count($event->getNote()) > 0) { |
|
93 | 93 | $note = current($event->getNote())->getNote(); |
94 | 94 | } |
95 | - else{ |
|
95 | + else { |
|
96 | 96 | $note = ''; |
97 | 97 | } |
98 | - if(isset($date) || isset($place)){ |
|
98 | + if (isset($date) || isset($place)) { |
|
99 | 99 | $place = isset($place) ? $place : 'No place'; |
100 | 100 | Note::create([ |
101 | 101 | 'name' => mb_convert_encoding($place, 'UTF-8', 'UTF-8'), |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | ]); |
105 | 105 | } |
106 | 106 | }; |
107 | - foreach ($media as $mediafile){ |
|
107 | + foreach ($media as $mediafile) { |
|
108 | 108 | $title = $mediafile->getTitl(); |
109 | 109 | $file = $mediafile->getFile(); |
110 | - if(isset($title) || isset($file)){ |
|
110 | + if (isset($title) || isset($file)) { |
|
111 | 111 | Note::create([ |
112 | 112 | 'name' => mb_convert_encoding($title, 'UTF-8', 'UTF-8'), |
113 | 113 | 'description' => mb_convert_encoding($file, 'UTF-8', 'UTF-8') |
@@ -122,32 +122,32 @@ discard block |
||
122 | 122 | ]); |
123 | 123 | } |
124 | 124 | |
125 | - private function get_Family($family){ |
|
126 | - $g_id = $family->getId() ; |
|
125 | + private function get_Family($family) { |
|
126 | + $g_id = $family->getId(); |
|
127 | 127 | $husb = $family->getHusb(); |
128 | 128 | $wife = $family->getWife(); |
129 | 129 | $children = $family->getChil(); |
130 | - $events =$family->getEven(); |
|
131 | - $husband_id = (isset($this->persons_id[$husb])) ? $this->persons_id[$husb]: 0; |
|
132 | - $wife_id = (isset($this->persons_id[$wife])) ? $this->persons_id[$wife]: 0; |
|
130 | + $events = $family->getEven(); |
|
131 | + $husband_id = (isset($this->persons_id[$husb])) ? $this->persons_id[$husb] : 0; |
|
132 | + $wife_id = (isset($this->persons_id[$wife])) ? $this->persons_id[$wife] : 0; |
|
133 | 133 | |
134 | 134 | Family::create([ |
135 | 135 | 'father_id' => $husband_id, |
136 | 136 | 'mother_id' => $wife_id, |
137 | - 'description' => $g_id . ' family', |
|
137 | + 'description' => $g_id.' family', |
|
138 | 138 | 'type_id' => 1 |
139 | 139 | ]); //father and mother id should be gedcom(string) type, not integer |
140 | 140 | |
141 | - foreach($children as $child){ |
|
142 | - if (isset($this->persons_id[$child])){ |
|
141 | + foreach ($children as $child) { |
|
142 | + if (isset($this->persons_id[$child])) { |
|
143 | 143 | $individual = Individual::find($this->persons_id[$child]); |
144 | 144 | $individual->children()->save($individual); |
145 | 145 | } |
146 | 146 | } |
147 | - foreach ($events as $event){ |
|
147 | + foreach ($events as $event) { |
|
148 | 148 | $date = $this->get_date($event->getDate()); |
149 | 149 | $place = $this->get_place($event->getPlac()); |
150 | - if(isset($date) || isset($place)){ |
|
150 | + if (isset($date) || isset($place)) { |
|
151 | 151 | $place = isset($place) ? $place : 'No place'; |
152 | 152 | Event::create([ |
153 | 153 | 'event_type' => 'App\Family', |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | }; |
162 | 162 | } |
163 | 163 | |
164 | - private function get_date($input_date){ |
|
164 | + private function get_date($input_date) { |
|
165 | 165 | return "$input_date"; |
166 | 166 | } |
167 | 167 | |
168 | - private function get_place($place){ |
|
169 | - if(is_object($place)){ |
|
168 | + private function get_place($place) { |
|
169 | + if (is_object($place)) { |
|
170 | 170 | $place = $place->getPlac(); |
171 | 171 | } |
172 | 172 | return $place; |