Passed
Push — master ( 1f995c...3a0433 )
by Jonathan
05:20
created
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.