Completed
Push — master ( 7f4bca...b9d3c1 )
by Jonathan
09:38
created
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,11 +259,12 @@  discard block
 block discarded – undo
255 259
                         if($level_map >= 0 && $level_map < count($levelvalues)) {
256 260
                             $levelref = $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
-                        if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref];
265
+                        if(isset($places_mappings[$levelref])) {
266
+                        	$levelref = $places_mappings[$levelref];
267
+                        }
263 268
                         if(isset($results_by_subdivs[$levelref])) {
264 269
                             $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0;
265 270
                             $count_subd  += $count;
@@ -277,8 +282,7 @@  discard block
 block discarded – undo
277 282
                 }
278 283
                 
279 284
                 $html = ViewFactory::make('GeoAnalysisTabGeneralMap', $this, new BaseController(), $data)->getHtmlPartial();
280
-            }
281
-            else {
285
+            } else {
282 286
                 $results = $placesGeneralResults['places'];
283 287
                 arsort($results);
284 288
                 $data->set('results', $results);
@@ -286,8 +290,7 @@  discard block
 block discarded – undo
286 290
                 
287 291
                 $html = ViewFactory::make('GeoAnalysisTabGeneralTable', $this, new BaseController(), $data)->getHtmlPartial();
288 292
             }
289
-        }
290
-        else {
293
+        } else {
291 294
             $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>';
292 295
         }
293 296
         return $html;
@@ -319,9 +322,15 @@  discard block
 block discarded – undo
319 322
                 $sum = 0;
320 323
                 $other = 0;
321 324
                 $unknown = 0;
322
-                if(isset($genData['sum'])) $sum = $genData['sum'];
323
-                if(isset($genData['other'])) $other = $genData['other'];
324
-                if(isset($genData['unknown'])) $unknown = $genData['unknown'];
325
+                if(isset($genData['sum'])) {
326
+                	$sum = $genData['sum'];
327
+                }
328
+                if(isset($genData['other'])) {
329
+                	$other = $genData['other'];
330
+                }
331
+                if(isset($genData['unknown'])) {
332
+                	$unknown = $genData['unknown'];
333
+                }
325 334
                 
326 335
                 if($sum > 0) {                
327 336
                     $results_by_gen[$gen]['sum'] = $sum;
@@ -339,8 +348,7 @@  discard block
 block discarded – undo
339 348
                                 $results_by_gen[$gen]['places'][$placename]['flag'] = $flag;
340 349
                             }
341 350
                         }
342
-                    }
343
-                    else {
351
+                    } else {
344 352
                         $tmp = $genData['places'];
345 353
                         if($other > 0) {
346 354
                             $tmp = array_slice($tmp, 0, 5, true);
@@ -356,8 +364,7 @@  discard block
 block discarded – undo
356 364
             
357 365
             $html = ViewFactory::make('GeoAnalysisTabGenerations', $this, new BaseController(), $data)->getHtmlPartial();
358 366
             
359
-        }
360
-        else {
367
+        } else {
361 368
             $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>';
362 369
         }
363 370
         return $html;
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/OutlineMap.php 1 patch
Braces   +25 added lines, -10 removed lines patch added patch discarded remove patch
@@ -70,7 +70,9 @@  discard block
 block discarded – undo
70 70
         $this->is_loaded = false;
71 71
         $this->subdivisions = array();
72 72
         $this->mappings = array();
73
-        if($load) $this->load();
73
+        if($load) {
74
+        	$this->load();
75
+        }
74 76
     }
75 77
     
76 78
     /**
@@ -117,7 +119,9 @@  discard block
 block discarded – undo
117 119
                 foreach($xml->subdivisions->children() as $subdivision){
118 120
                     $attributes = $subdivision->attributes();
119 121
                     $key = trim($attributes['name']);
120
-                    if(isset($attributes['parent'])) $key .= '@'.trim($attributes['parent']);
122
+                    if(isset($attributes['parent'])) {
123
+                    	$key .= '@'.trim($attributes['parent']);
124
+                    }
121 125
                     $this->subdivisions[$key] = array(
122 126
                         'id' => trim($attributes['id']),
123 127
                         'displayname' => trim($attributes['name']),
@@ -144,9 +148,10 @@  discard block
 block discarded – undo
144 148
      */
145 149
     public function isLoaded() {
146 150
         try{
147
-            if(!$this->is_loaded) $this->load();
148
-        }
149
-        catch (\Exception $ex) { }
151
+            if(!$this->is_loaded) {
152
+            	$this->load();
153
+            }
154
+        } catch (\Exception $ex) { }
150 155
         return $this->is_loaded;
151 156
     }
152 157
     
@@ -163,7 +168,9 @@  discard block
 block discarded – undo
163 168
 	 * @return string
164 169
 	 */
165 170
     public function getDescription() {
166
-        if(!$this->is_loaded) $this->load();
171
+        if(!$this->is_loaded) {
172
+        	$this->load();
173
+        }
167 174
         return $this->description;
168 175
     }
169 176
     
@@ -172,7 +179,9 @@  discard block
 block discarded – undo
172 179
 	 * @return string
173 180
 	 */
174 181
     public function getTopLevelName() {
175
-        if(!$this->is_loaded) $this->load();
182
+        if(!$this->is_loaded) {
183
+        	$this->load();
184
+        }
176 185
         return $this->top_level_name;
177 186
     }    
178 187
     
@@ -181,7 +190,9 @@  discard block
 block discarded – undo
181 190
      * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\OutlineMapCanvas
182 191
      */
183 192
     public function getCanvas() {
184
-        if(!$this->is_loaded) $this->load();
193
+        if(!$this->is_loaded) {
194
+        	$this->load();
195
+        }
185 196
         return $this->canvas;
186 197
     }
187 198
     
@@ -190,7 +201,9 @@  discard block
 block discarded – undo
190 201
      * @return array
191 202
      */
192 203
     public function getSubdivisions() {
193
-        if(!$this->is_loaded) $this->load();
204
+        if(!$this->is_loaded) {
205
+        	$this->load();
206
+        }
194 207
         return $this->subdivisions;
195 208
     }
196 209
     
@@ -199,7 +212,9 @@  discard block
 block discarded – undo
199 212
      * @return array
200 213
      */
201 214
     public function getPlacesMappings() {
202
-        if(!$this->is_loaded) $this->load();
215
+        if(!$this->is_loaded) {
216
+        	$this->load();
217
+        }
203 218
         return $this->mappings;
204 219
     }
205 220
     
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');
@@ -259,8 +263,7 @@  discard block
 block discarded – undo
259 263
     		            $datum[7] .= $top_level . '(' . $place_hierarchy['hierarchy'][$top_level - 1] . ')';
260 264
     		        }
261 265
     		        $datum[7] .= '</span>';
262
-		        }
263
-		        else {
266
+		        } else {
264 267
 		            $datum[6] = I18N::translate('Error when loading map.');
265 268
 		        }
266 269
 		    }
@@ -335,8 +338,7 @@  discard block
 block discarded – undo
335 338
                     if($use_map) {
336 339
                         $options->setMap(new OutlineMap($map_file));
337 340
                         $options->setMapLevel($map_top_level + 1);
338
-                    }
339
-                    else {
341
+                    } else {
340 342
                         $options->setMap(null);
341 343
                     }
342 344
                 }
@@ -347,8 +349,7 @@  discard block
 block discarded – undo
347 349
 					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$res->getId().'” has been updated.');
348 350
 					$ga = $res;
349 351
 					$success = true;
350
-				}
351
-				else {
352
+				} else {
352 353
 					FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger');
353 354
 					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'. $ga->getId() .'” could not be updated. See error log.');
354 355
 				}
@@ -366,8 +367,7 @@  discard block
 block discarded – undo
366 367
 				FlashMessages::addMessage(I18N::translate('The geographical dispersion analysis “%s” has been successfully added.', $ga->getTitle()), 'success');
367 368
 				Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$ga->getId().'” has been added.');
368 369
 				$success = true;
369
-			}
370
-			else {
370
+			} else {
371 371
 				FlashMessages::addMessage(I18N::translate('An error occured while adding the geographical dispersion analysis “%s”', $description), 'danger');
372 372
 				Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis “'.$description.'” could not be added. See error log.');
373 373
 			}
@@ -377,8 +377,7 @@  discard block
 block discarded – undo
377 377
         if(!$success) {			
378 378
             if($ga) {
379 379
                 $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $wt_tree->getNameUrl();
380
-            }
381
-            else {
380
+            } else {
382 381
                 $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $wt_tree->getNameUrl();
383 382
             }
384 383
         }        
@@ -435,7 +434,9 @@  discard block
 block discarded – undo
435 434
         $data->set('map_list', $map_list);
436 435
     
437 436
         $gen_details = array(0 => I18N::translate('All'));
438
-        for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i;
437
+        for($i = 1; $i <= 10 ; $i++) {
438
+        	$gen_details[$i] = $i;
439
+        }
439 440
         $data->set('generation_details', $gen_details);
440 441
     
441 442
         ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render();
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Model/SosaProvider.php 1 patch
Braces   +77 added lines, -30 removed lines patch added patch discarded remove patch
@@ -84,21 +84,25 @@  discard block
 block discarded – undo
84 84
      * @param User $user
85 85
      */
86 86
     public function __construct(Tree $tree, User $user = null) {
87
-        if(self::$default_user === null) 
88
-            self::$default_user = User::find(-1);
87
+        if(self::$default_user === null) {
88
+                    self::$default_user = User::find(-1);
89
+        }
89 90
         
90 91
         $this->tree = $tree;
91 92
         $this->user = $user;
92 93
         $this->is_setup = true;
93
-        if($this->user === null) $this->user = Auth::user();
94
-        if(strlen($this->user->getUserId()) == 0) $this->user = self::$default_user;
94
+        if($this->user === null) {
95
+        	$this->user = Auth::user();
96
+        }
97
+        if(strlen($this->user->getUserId()) == 0) {
98
+        	$this->user = self::$default_user;
99
+        }
95 100
         
96 101
         // Check if the user, or the default user, has a root already setup;
97 102
         if(empty($this->getRootIndiId())) {
98 103
             if($this->user == self::$default_user) {  // If the default user is not setup
99 104
                 $this->is_setup = false;
100
-            }
101
-            else {
105
+            } else {
102 106
                 $this->user = self::$default_user;
103 107
                 $this->is_setup = $this->getRootIndiId() === null;
104 108
             }            
@@ -141,7 +145,9 @@  discard block
 block discarded – undo
141 145
      * Remove all Sosa entries related to the gedcom file and user
142 146
      */
143 147
     public function deleteAll() {
144
-        if(!$this->is_setup) return;
148
+        if(!$this->is_setup) {
149
+        	return;
150
+        }
145 151
         Database::prepare(
146 152
             'DELETE FROM `##maj_sosa`'.
147 153
             ' WHERE majs_gedcom_id= :tree_id and majs_user_id = :user_id ')
@@ -157,7 +163,9 @@  discard block
 block discarded – undo
157 163
      * @param int $sosa
158 164
      */
159 165
     public function deleteAncestors($sosa) {
160
-        if(!$this->is_setup) return;
166
+        if(!$this->is_setup) {
167
+        	return;
168
+        }
161 169
         $gen = Functions::getGeneration($sosa);
162 170
         Database::prepare(
163 171
             'DELETE FROM `##maj_sosa`'.
@@ -177,7 +185,9 @@  discard block
 block discarded – undo
177 185
      * @param array $sosa_records
178 186
      */
179 187
     public function insertOrUpdate($sosa_records) {
180
-        if(!$this->is_setup) return;
188
+        if(!$this->is_setup) {
189
+        	return;
190
+        }
181 191
         
182 192
         $treeid = $this->tree->getTreeId();
183 193
         $userid = $this->user->getUserId();
@@ -224,7 +234,9 @@  discard block
 block discarded – undo
224 234
      * @return array Array of sosa numbers
225 235
      */
226 236
     public function getSosaNumbers(Individual $indi) {
227
-        if(!$this->is_setup) return array();
237
+        if(!$this->is_setup) {
238
+        	return array();
239
+        }
228 240
         return Database::prepare(
229 241
                 'SELECT majs_sosa, majs_gen FROM `##maj_sosa`'.
230 242
                 ' WHERE majs_i_id=:indi_id AND majs_gedcom_id=:tree_id AND majs_user_id=:user_id'
@@ -241,7 +253,9 @@  discard block
 block discarded – undo
241 253
      * @return number Last generation if found, 1 otherwise
242 254
      */
243 255
     public function getLastGeneration() {
244
-        if(!$this->is_setup) return;
256
+        if(!$this->is_setup) {
257
+        	return;
258
+        }
245 259
         return Database::prepare(
246 260
                 'SELECT MAX(majs_gen) FROM `##maj_sosa`'.
247 261
                 ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'
@@ -261,7 +275,9 @@  discard block
 block discarded – undo
261 275
      * @return array Associative array of Sosa ancestors, with their generation, comma separated
262 276
      */
263 277
     public function getAllSosaWithGenerations(){
264
-        if(!$this->is_setup) return array();
278
+        if(!$this->is_setup) {
279
+        	return array();
280
+        }
265 281
         return Database::prepare(
266 282
             'SELECT majs_i_id AS indi,' .
267 283
             ' GROUP_CONCAT(DISTINCT majs_gen ORDER BY majs_gen ASC SEPARATOR ",") AS generations' .
@@ -281,9 +297,12 @@  discard block
 block discarded – undo
281 297
      * @return array Array of Sosa individuals
282 298
      */
283 299
     public function getSosaListAtGeneration($gen){
284
-        if(!$this->is_setup) return array();
285
-        if(!$this->sosa_list_by_gen)
286
-            $this->sosa_list_by_gen = array();
300
+        if(!$this->is_setup) {
301
+        	return array();
302
+        }
303
+        if(!$this->sosa_list_by_gen) {
304
+                    $this->sosa_list_by_gen = array();
305
+        }
287 306
         
288 307
         if($gen){
289 308
             if(!isset($this->sosa_list_by_gen[$gen])){
@@ -312,9 +331,12 @@  discard block
 block discarded – undo
312 331
      * @return array Array of Sosa families
313 332
      */
314 333
     public function getFamilySosaListAtGeneration($gen){
315
-        if(!$this->is_setup) return array();
316
-        if(!$this->sosa_fam_list_by_gen)
317
-            $this->sosa_fam_list_by_gen = array();
334
+        if(!$this->is_setup) {
335
+        	return array();
336
+        }
337
+        if(!$this->sosa_fam_list_by_gen) {
338
+                    $this->sosa_fam_list_by_gen = array();
339
+        }
318 340
         
319 341
         if($gen){
320 342
             if(!isset($this->sosa_fam_list_by_gen[$gen])){
@@ -348,7 +370,9 @@  discard block
 block discarded – undo
348 370
      * @return array Array of Sosa individuals
349 371
      */
350 372
     public function getMissingSosaListAtGeneration($gen){
351
-        if(!$this->is_setup) return array();    
373
+        if(!$this->is_setup) {
374
+        	return array();
375
+        }
352 376
         if($gen){
353 377
             return $this->sosa_list_by_gen[$gen] = Database::prepare(
354 378
                 'SELECT schild.majs_sosa sosa, schild.majs_i_id indi, sfat.majs_sosa IS NOT NULL has_father, smot.majs_sosa IS NOT NULL has_mother'.
@@ -386,7 +410,9 @@  discard block
 block discarded – undo
386 410
      * @return array Statistics array
387 411
      */
388 412
     public function getStatisticsByGeneration() {
389
-        if(!$this->is_setup) return array();
413
+        if(!$this->is_setup) {
414
+        	return array();
415
+        }
390 416
         if(!$this->statistics_tab) {
391 417
             $this->statistics_tab = array();
392 418
             if($maxGeneration = $this->getLastGeneration()) {
@@ -412,7 +438,9 @@  discard block
 block discarded – undo
412 438
 	 * @return int
413 439
 	 */
414 440
 	public function getTotalIndividuals() {
415
-	    if(!$this->is_setup) return 0;
441
+	    if(!$this->is_setup) {
442
+	    	return 0;
443
+	    }
416 444
 	    return Database::prepare(
417 445
 	        'SELECT COUNT(*) FROM `##individuals`' .
418 446
 	        ' WHERE i_file = :tree_id')
@@ -426,7 +454,9 @@  discard block
 block discarded – undo
426 454
      * @return number Number of Sosas
427 455
      */
428 456
     public function getSosaCount(){
429
-        if(!$this->is_setup) return 0;
457
+        if(!$this->is_setup) {
458
+        	return 0;
459
+        }
430 460
         return Database::prepare(
431 461
             'SELECT COUNT(majs_sosa) FROM `##maj_sosa`' .
432 462
             ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id')
@@ -443,7 +473,9 @@  discard block
 block discarded – undo
443 473
      * @return number Number of Sosas in generation
444 474
      */
445 475
     public function getSosaCountAtGeneration($gen){
446
-        if(!$this->is_setup) return 0;
476
+        if(!$this->is_setup) {
477
+        	return 0;
478
+        }
447 479
         return Database::prepare(
448 480
             'SELECT COUNT(majs_sosa) FROM `##maj_sosa`' .
449 481
             ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
@@ -462,7 +494,9 @@  discard block
 block discarded – undo
462 494
      * @return number Total number of Sosas up to generation
463 495
      */
464 496
     public function getSosaCountUpToGeneration($gen){
465
-        if(!$this->is_setup) return 0;
497
+        if(!$this->is_setup) {
498
+        	return 0;
499
+        }
466 500
         return Database::prepare(
467 501
             'SELECT COUNT(majs_sosa) FROM `##maj_sosa`' .
468 502
             ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
@@ -480,7 +514,9 @@  discard block
 block discarded – undo
480 514
      * @return number Total number of distinct individual
481 515
      */
482 516
     public function getDifferentSosaCount(){
483
-        if(!$this->is_setup) return 0;
517
+        if(!$this->is_setup) {
518
+        	return 0;
519
+        }
484 520
         return Database::prepare(
485 521
             'SELECT COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' .
486 522
             ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id')
@@ -497,7 +533,9 @@  discard block
 block discarded – undo
497 533
      * @return number Number of distinct Sosa individuals up to generation
498 534
      */
499 535
     public function getDifferentSosaCountUpToGeneration($gen){
500
-        if(!$this->is_setup) return 0;
536
+        if(!$this->is_setup) {
537
+        	return 0;
538
+        }
501 539
         return Database::prepare(
502 540
             'SELECT COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' .
503 541
             ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
@@ -520,7 +558,9 @@  discard block
 block discarded – undo
520 558
      * @return array Birth statistics array
521 559
      */
522 560
     public function getStatsBirthYearInGeneration($gen){
523
-        if(!$this->is_setup) return array('first' => 0, 'avg' => 0, 'last' => 0);
561
+        if(!$this->is_setup) {
562
+        	return array('first' => 0, 'avg' => 0, 'last' => 0);
563
+        }
524 564
         return Database::prepare(
525 565
             'SELECT MIN(majs_birth_year) AS first, AVG(majs_birth_year) AS avg, MAX(majs_birth_year) AS last'.
526 566
             ' FROM `##maj_sosa`' .
@@ -540,7 +580,9 @@  discard block
 block discarded – undo
540 580
      * @return number|NULL Mean generation time
541 581
      */
542 582
     public function getMeanGenerationTime(){
543
-        if(!$this->is_setup) return;
583
+        if(!$this->is_setup) {
584
+        	return;
585
+        }
544 586
         if(!$this->statistics_tab){
545 587
             $this->getStatisticsByGeneration();
546 588
         }
@@ -586,7 +628,10 @@  discard block
 block discarded – undo
586 628
      * @return array
587 629
      */
588 630
     public function getAncestorDispersionForGen($gen) {
589
-        if(!$this->is_setup || $gen > 11) return array();  // Going further than 11 gen will be out of range in the query
631
+        if(!$this->is_setup || $gen > 11) {
632
+        	return array();
633
+        }
634
+        // Going further than 11 gen will be out of range in the query
590 635
         return Database::prepare(
591 636
             'SELECT branches, count(i_id)'.
592 637
             ' FROM ('.
@@ -626,7 +671,9 @@  discard block
 block discarded – undo
626 671
      * @return array 
627 672
      */
628 673
     public function getTopMultiSosaAncestorsNoTies($limit) {
629
-        if(!$this->is_setup) return array();
674
+        if(!$this->is_setup) {
675
+        	return array();
676
+        }
630 677
         return Database::prepare(
631 678
             'SELECT sosa_i_id, sosa_count FROM ('.
632 679
             '   SELECT'.
Please login to merge, or discard this patch.