Passed
Branch feature/2.0 (be78a0)
by Jonathan
11:57
created
src/Webtrees/Module/GeoDispersion/Model/OutlineMap.php 1 patch
Braces   +25 added lines, -10 removed lines patch added patch discarded remove patch
@@ -71,7 +71,9 @@  discard block
 block discarded – undo
71 71
         $this->is_loaded = false;
72 72
         $this->subdivisions = array();
73 73
         $this->mappings = array();
74
-        if($load) $this->load();
74
+        if($load) {
75
+        	$this->load();
76
+        }
75 77
     }
76 78
     
77 79
     /**
@@ -118,7 +120,9 @@  discard block
 block discarded – undo
118 120
                 foreach($xml->subdivisions->children() as $subdivision){
119 121
                     $attributes = $subdivision->attributes();
120 122
                     $key = I18N::strtolower(trim($attributes['name']));
121
-                    if(isset($attributes['parent'])) $key .= '@'. I18N::strtolower(trim($attributes['parent']));
123
+                    if(isset($attributes['parent'])) {
124
+                    	$key .= '@'. I18N::strtolower(trim($attributes['parent']));
125
+                    }
122 126
                     $this->subdivisions[$key] = array(
123 127
                         'id' => trim($attributes['id']),
124 128
                         'displayname' => trim($attributes['name']),
@@ -145,9 +149,10 @@  discard block
 block discarded – undo
145 149
      */
146 150
     public function isLoaded() {
147 151
         try{
148
-            if(!$this->is_loaded) $this->load();
149
-        }
150
-        catch (\Exception $ex) { }
152
+            if(!$this->is_loaded) {
153
+            	$this->load();
154
+            }
155
+        } catch (\Exception $ex) { }
151 156
         return $this->is_loaded;
152 157
     }
153 158
     
@@ -164,7 +169,9 @@  discard block
 block discarded – undo
164 169
 	 * @return string
165 170
 	 */
166 171
     public function getDescription() {
167
-        if(!$this->is_loaded) $this->load();
172
+        if(!$this->is_loaded) {
173
+        	$this->load();
174
+        }
168 175
         return $this->description;
169 176
     }
170 177
     
@@ -173,7 +180,9 @@  discard block
 block discarded – undo
173 180
 	 * @return string
174 181
 	 */
175 182
     public function getTopLevelName() {
176
-        if(!$this->is_loaded) $this->load();
183
+        if(!$this->is_loaded) {
184
+        	$this->load();
185
+        }
177 186
         return $this->top_level_name;
178 187
     }    
179 188
     
@@ -182,7 +191,9 @@  discard block
 block discarded – undo
182 191
      * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\OutlineMapCanvas
183 192
      */
184 193
     public function getCanvas() {
185
-        if(!$this->is_loaded) $this->load();
194
+        if(!$this->is_loaded) {
195
+        	$this->load();
196
+        }
186 197
         return $this->canvas;
187 198
     }
188 199
     
@@ -191,7 +202,9 @@  discard block
 block discarded – undo
191 202
      * @return array
192 203
      */
193 204
     public function getSubdivisions() {
194
-        if(!$this->is_loaded) $this->load();
205
+        if(!$this->is_loaded) {
206
+        	$this->load();
207
+        }
195 208
         return $this->subdivisions;
196 209
     }
197 210
     
@@ -200,7 +213,9 @@  discard block
 block discarded – undo
200 213
      * @return array
201 214
      */
202 215
     public function getPlacesMappings() {
203
-        if(!$this->is_loaded) $this->load();
216
+        if(!$this->is_loaded) {
217
+        	$this->load();
218
+        }
204 219
         return $this->mappings;
205 220
     }
206 221
     
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/GeoAnalysisController.php 1 patch
Braces   +28 added lines, -21 removed lines patch added patch discarded remove patch
@@ -144,14 +144,15 @@  discard block
 block discarded – undo
144 144
             $this->provider->setGeoAnalysisStatus($ga, $status);
145 145
             $res['status'] = $status;
146 146
 			Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '. ($status ? 'enabled' : 'disabled') .'.');
147
-        }
148
-        catch (\Exception $ex) {
147
+        } catch (\Exception $ex) {
149 148
             $res['error'] = $ex->getMessage();
150 149
 			Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage());
151 150
         }
152 151
         
153 152
         $controller->pageHeader();
154
-        if($res['error']) http_response_code(500);
153
+        if($res['error']) {
154
+        	http_response_code(500);
155
+        }
155 156
         
156 157
         $controller->encode($res);
157 158
     }
@@ -175,14 +176,15 @@  discard block
 block discarded – undo
175 176
         try{
176 177
             $this->provider->deleteGeoAnalysis($ga);
177 178
 			Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.');
178
-        }
179
-        catch (\Exception $ex) {
179
+        } catch (\Exception $ex) {
180 180
             $res['error'] = $ex->getMessage();
181 181
 			Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '. $ex->getMessage());
182 182
         }
183 183
     
184 184
         $controller->pageHeader();
185
-        if($res['error']) http_response_code(500);
185
+        if($res['error']) {
186
+        	http_response_code(500);
187
+        }
186 188
 
187 189
         $controller->encode($res);
188 190
     }
@@ -234,7 +236,9 @@  discard block
 block discarded – undo
234 236
             
235 237
             $nb_found = $placesGeneralResults['knownsum'];
236 238
             $nb_other = 0;
237
-            if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other'];
239
+            if(isset($placesGeneralResults['other'])) {
240
+            	$nb_other =$placesGeneralResults['other'];
241
+            }
238 242
             $nb_unknown = $placesGeneralResults['unknown'];
239 243
             
240 244
             $data->set('stats_gen_nb_found', $nb_found);
@@ -255,12 +259,13 @@  discard block
 block discarded – undo
255 259
                         if($level_map >= 0 && $level_map < count($levelvalues)) {
256 260
                             $levelref = I18N::strtolower($levelvalues[0] . '@' . $levelvalues[$level_map]);
257 261
                             if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; }
258
-                        }
259
-                        else {
262
+                        } else {
260 263
                             $levelref = $levelvalues[0];
261 264
                         }
262 265
                         $levelref = I18N::strtolower($levelref);
263
-                        if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref];
266
+                        if(isset($places_mappings[$levelref])) {
267
+                        	$levelref = $places_mappings[$levelref];
268
+                        }
264 269
                         if(isset($results_by_subdivs[$levelref])) {
265 270
                             $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0;
266 271
                             $count_subd  += $count;
@@ -278,8 +283,7 @@  discard block
 block discarded – undo
278 283
                 }
279 284
                 
280 285
                 $html = ViewFactory::make('GeoAnalysisTabGeneralMap', $this, new BaseController(), $data)->getHtmlPartial();
281
-            }
282
-            else {
286
+            } else {
283 287
                 $results = $placesGeneralResults['places'];
284 288
                 arsort($results);
285 289
                 $data->set('results', $results);
@@ -287,8 +291,7 @@  discard block
 block discarded – undo
287 291
                 
288 292
                 $html = ViewFactory::make('GeoAnalysisTabGeneralTable', $this, new BaseController(), $data)->getHtmlPartial();
289 293
             }
290
-        }
291
-        else {
294
+        } else {
292 295
             $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>';
293 296
         }
294 297
         return $html;
@@ -320,9 +323,15 @@  discard block
 block discarded – undo
320 323
                 $sum = 0;
321 324
                 $other = 0;
322 325
                 $unknown = 0;
323
-                if(isset($genData['sum'])) $sum = $genData['sum'];
324
-                if(isset($genData['other'])) $other = $genData['other'];
325
-                if(isset($genData['unknown'])) $unknown = $genData['unknown'];
326
+                if(isset($genData['sum'])) {
327
+                	$sum = $genData['sum'];
328
+                }
329
+                if(isset($genData['other'])) {
330
+                	$other = $genData['other'];
331
+                }
332
+                if(isset($genData['unknown'])) {
333
+                	$unknown = $genData['unknown'];
334
+                }
326 335
                 
327 336
                 if($sum > 0) {                
328 337
                     $results_by_gen[$gen]['sum'] = $sum;
@@ -340,8 +349,7 @@  discard block
 block discarded – undo
340 349
                                 $results_by_gen[$gen]['places'][$placename]['flag'] = $flag;
341 350
                             }
342 351
                         }
343
-                    }
344
-                    else {
352
+                    } else {
345 353
                         $tmp = $genData['places'];
346 354
                         if($other > 0) {
347 355
                             $tmp = array_slice($tmp, 0, 5, true);
@@ -357,8 +365,7 @@  discard block
 block discarded – undo
357 365
             
358 366
             $html = ViewFactory::make('GeoAnalysisTabGenerations', $this, new BaseController(), $data)->getHtmlPartial();
359 367
             
360
-        }
361
-        else {
368
+        } else {
362 369
             $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>';
363 370
         }
364 371
         return $html;
Please login to merge, or discard this patch.
src/Webtrees/ImageBuilder.php 1 patch
Braces   +16 added lines, -7 removed lines patch added patch discarded remove patch
@@ -95,7 +95,9 @@  discard block
 block discarded – undo
95 95
 	 * @return ImageBuilder
96 96
 	 */
97 97
 	public function setExpireOffset($expireOffset) {
98
-	    if($expireOffset) $this->expire_offset = $expireOffset;
98
+	    if($expireOffset) {
99
+	    	$this->expire_offset = $expireOffset;
100
+	    }
99 101
 	    return $this;
100 102
 	}
101 103
 	
@@ -115,7 +117,9 @@  discard block
 block discarded – undo
115 117
 	 * @return ImageBuilder
116 118
 	 */
117 119
 	public function setShowWatermark($show_watermark) {
118
-	    if(!is_null($show_watermark)) $this->show_watermark = $show_watermark;
120
+	    if(!is_null($show_watermark)) {
121
+	    	$this->show_watermark = $show_watermark;
122
+	    }
119 123
 	    return $this;
120 124
 	}
121 125
 	
@@ -126,7 +130,9 @@  discard block
 block discarded – undo
126 130
 	 * @return ImageBuilder
127 131
 	 */
128 132
 	public function setFontMaxSize($font_max_size) {
129
-	    if($font_max_size) $this->font_max_size = $font_max_size;
133
+	    if($font_max_size) {
134
+	    	$this->font_max_size = $font_max_size;
135
+	    }
130 136
 	    return $this;
131 137
 	}
132 138
 	
@@ -137,7 +143,9 @@  discard block
 block discarded – undo
137 143
 	 * @return ImageBuilder
138 144
 	 */
139 145
 	public function setFontColor($font_color) {
140
-	    if($font_color) $this->font_color = $font_color;
146
+	    if($font_color) {
147
+	    	$this->font_color = $font_color;
148
+	    }
141 149
 	    return $this;
142 150
 	}
143 151
 	
@@ -148,7 +156,9 @@  discard block
 block discarded – undo
148 156
 	 * @return ImageBuilder
149 157
 	 */
150 158
 	public function setAsAttachment($is_attachement) {
151
-	    if(is_bool($is_attachement)) $this->as_attachment = $is_attachement;
159
+	    if(is_bool($is_attachement)) {
160
+	    	$this->as_attachment = $is_attachement;
161
+	    }
152 162
 	    return $this;
153 163
 	}
154 164
 	
@@ -300,8 +310,7 @@  discard block
 block discarded – undo
300 310
 	    // text to watermark with	    
301 311
 	    if(method_exists($this->media, 'getWatermarkText')) {
302 312
 	       $word1_text = $this->media->getWatermarkText();
303
-	    }
304
-	    else {
313
+	    } else {
305 314
 	        $word1_text = $this->media->getTitle();
306 315
 	    }
307 316
 	
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/GeoAnalysisProvider.php 1 patch
Braces   +8 added lines, -11 removed lines patch added patch discarded remove patch
@@ -167,8 +167,7 @@  discard block
 block discarded – undo
167 167
 			$ga = $this->getGeoAnalysis($id, false);
168 168
 			
169 169
 			Database::commit();
170
-		}
171
-		catch(\Exception $ex) {
170
+		} catch(\Exception $ex) {
172 171
 			Database::rollback();
173 172
 			$ga = null;
174 173
 			Log::addErrorLog('A new Geo Analysis failed to be created. Transaction rollbacked. Parameters ['.$description.', '.$analysis_level.','.$map_file.','.$map_top_level.','.$use_flags.', '.$gen_details.']. Exception: '.$ex->getMessage());
@@ -210,8 +209,7 @@  discard block
 block discarded – undo
210 209
 			$ga = $this->getGeoAnalysis($ga->getId(), false);
211 210
 			
212 211
 			 Database::commit();
213
-		}
214
-		catch(\Exception $ex) {		    
212
+		} catch(\Exception $ex) {		    
215 213
 			Database::rollback();
216 214
 			Log::addErrorLog('The Geo Analysis ID “' . $ga->getId() . '” failed to be updated. Transaction rollbacked. Exception: '.$ex->getMessage());
217 215
 			$ga = null;
@@ -350,11 +348,9 @@  discard block
 block discarded – undo
350 348
         if(!$this->place_hierarchy) {
351 349
             if($place_structure = $this->getPlacesHierarchyFromHeader()) {
352 350
                 $this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure);
353
-            }
354
-            elseif ($place_structure = $this->getPlacesHierarchyFromData()){
351
+            } elseif ($place_structure = $this->getPlacesHierarchyFromData()){
355 352
                 $this->place_hierarchy = array('type' => 'data', 'hierarchy' => $place_structure);
356
-            }
357
-            else {
353
+            } else {
358 354
                 $this->place_hierarchy = array('type' => 'none', 'hierarchy' => null);
359 355
             }
360 356
         }
@@ -418,14 +414,15 @@  discard block
 block discarded – undo
418 414
             if($parts > $max_level) {
419 415
                 $max_level = $parts;
420 416
                 $places_with_high_level = array($place);
421
-            }
422
-            else if ($parts == $max_level) {
417
+            } else if ($parts == $max_level) {
423 418
                 $places_with_high_level[] = $place;
424 419
             }
425 420
         }
426 421
         
427 422
         // If empty array, then return null
428
-        if($max_level == 0) return null;
423
+        if($max_level == 0) {
424
+        	return null;
425
+        }
429 426
                 
430 427
         // Else, return the first alphabetical element -- cannot return random to ensure always the same example if used
431 428
         usort($places_with_high_level, array('Fisharebest\\Webtrees\\I18N', 'strcasecmp'));        
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/AdminConfigController.php 1 patch
Braces   +14 added lines, -13 removed lines patch added patch discarded remove patch
@@ -78,7 +78,9 @@  discard block
 block discarded – undo
78 78
         
79 79
         $other_trees = array();
80 80
         foreach (Tree::getAll() as $tree) {
81
-            if($tree->getTreeId() != $wt_tree->getTreeId()) $other_trees[] = $tree;
81
+            if($tree->getTreeId() != $wt_tree->getTreeId()) {
82
+            	$other_trees[] = $tree;
83
+            }
82 84
         }      
83 85
         $data->set('other_trees', $other_trees);
84 86
         
@@ -177,7 +179,9 @@  discard block
 block discarded – undo
177 179
         
178 180
         // Generate an AJAX/JSON response for datatables to load a block of rows
179 181
         $search = Filter::postArray('search');
180
-        if($search) $search = $search['value'];
182
+        if($search) {
183
+        	$search = $search['value'];
184
+        }
181 185
         $start  = Filter::postInteger('start');
182 186
         $length = Filter::postInteger('length');
183 187
         $order  = Filter::postArray('order');
@@ -263,8 +267,7 @@  discard block
 block discarded – undo
263 267
     		            $datum[7] .= $top_level;
264 268
     		        }
265 269
     		        $datum[7] .= '</span>';
266
-		        }
267
-		        else {
270
+		        } else {
268 271
 		            $datum[6] = I18N::translate('Error when loading map.');
269 272
 		        }
270 273
 		    }
@@ -339,8 +342,7 @@  discard block
 block discarded – undo
339 342
                     if($use_map) {
340 343
                         $options->setMap(new OutlineMap($map_file));
341 344
                         $options->setMapLevel($map_top_level + 1);
342
-                    }
343
-                    else {
345
+                    } else {
344 346
                         $options->setMap(null);
345 347
                     }
346 348
                 }
@@ -351,8 +353,7 @@  discard block
 block discarded – undo
351 353
 					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$res->getId().'” has been updated.');
352 354
 					$ga = $res;
353 355
 					$success = true;
354
-				}
355
-				else {
356
+				} else {
356 357
 					FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger');
357 358
 					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'. $ga->getId() .'” could not be updated. See error log.');
358 359
 				}
@@ -370,8 +371,7 @@  discard block
 block discarded – undo
370 371
 				FlashMessages::addMessage(I18N::translate('The geographical dispersion analysis “%s” has been successfully added.', $ga->getTitle()), 'success');
371 372
 				Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$ga->getId().'” has been added.');
372 373
 				$success = true;
373
-			}
374
-			else {
374
+			} else {
375 375
 				FlashMessages::addMessage(I18N::translate('An error occured while adding the geographical dispersion analysis “%s”', $description), 'danger');
376 376
 				Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis “'.$description.'” could not be added. See error log.');
377 377
 			}
@@ -381,8 +381,7 @@  discard block
 block discarded – undo
381 381
         if(!$success) {			
382 382
             if($ga) {
383 383
                 $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $wt_tree->getNameUrl();
384
-            }
385
-            else {
384
+            } else {
386 385
                 $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $wt_tree->getNameUrl();
387 386
             }
388 387
         }        
@@ -439,7 +438,9 @@  discard block
 block discarded – undo
439 438
         $data->set('map_list', $map_list);
440 439
     
441 440
         $gen_details = array(0 => I18N::translate('All'));
442
-        for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i;
441
+        for($i = 1; $i <= 10 ; $i++) {
442
+        	$gen_details[$i] = $i;
443
+        }
443 444
         $data->set('generation_details', $gen_details);
444 445
     
445 446
         ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render();
Please login to merge, or discard this patch.
src/Webtrees/Module/AbstractModuleMaj.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -104,8 +104,7 @@
 block discarded – undo
104 104
         
105 105
         if(file_exists($css_file)) {
106 106
             return $this->assetUrl('css/' . $theme->name() . '.min.css');
107
-        }
108
-        else {
107
+        } else {
109 108
             return $this->assetUrl('css/default.min.css');
110 109
         }
111 110
     }
Please login to merge, or discard this patch.