Completed
Push — feature/code-analysis ( 820b23...92a398 )
by Jonathan
04:40 queued 01:48
created
src/Webtrees/Module/GeoDispersionModule.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@
 block discarded – undo
79 79
             Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
80 80
             
81 81
             return !is_null(Module::getModuleByName(Constants::MODULE_MAJ_SOSA_NAME));
82
-        }
83
-        catch (\Exception $ex) {  }
82
+        } catch (\Exception $ex) {  }
84 83
         return false;
85 84
     }
86 85
     
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookProvider.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -93,16 +93,14 @@
 block discarded – undo
93 93
 							if(is_int($key)) {
94 94
 								$hook_item = $value;
95 95
 								$priority = self::DEFAULT_PRIORITY;
96
-							}
97
-							else{
96
+							} else{
98 97
 								$hook_item = explode('#', $key, 2);
99 98
 								$priority = $value;
100 99
 							}
101 100
 							if($hook_item && count($hook_item) == 2){
102 101
 								$hook_func = $hook_item[0];
103 102
 								$hook_cont = $hook_item[1];
104
-							}
105
-							else{
103
+							} else{
106 104
 								$hook_func = $hook_item[0];
107 105
 								$hook_cont = 'all';
108 106
 							}
Please login to merge, or discard this patch.
src/Webtrees/Module/WelcomeBlock/PiwikController.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,9 @@
 block discarded – undo
50 50
         
51 51
             if($fetched = File::fetchUrl($url)) {
52 52
                 $content = @unserialize($fetched);
53
-                if(is_numeric($content)) return $content;
53
+                if(is_numeric($content)) {
54
+                	return $content;
55
+                }
54 56
             }
55 57
         }
56 58
     
Please login to merge, or discard this patch.
src/Webtrees/Module/Certificates/Views/CertificatesListView.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,8 @@  discard block
 block discarded – undo
39 39
     			<input type="hidden" name="ged" value="<?= $this->data->get('url_ged') ?>">
40 40
     			<select name="city">
41 41
     			<?php foreach ($cities as $city) { ?>
42
-    				<option value="<?= Functions::encryptToSafeBase64($city) ?>" <?php if(trim($city) == trim($selected_city)) echo 'selected="selected"'?> ><?= $city ?></option>
42
+    				<option value="<?= Functions::encryptToSafeBase64($city) ?>" <?php if(trim($city) == trim($selected_city)) {
43
+	echo 'selected="selected"'?> ><?= $city ?></option>
43 44
     			<?php } ?>
44 45
     			</select>
45 46
     			<input type="submit" value="<?= I18N::translate('Show') ?>" />
@@ -72,9 +73,12 @@  discard block
 block discarded – undo
72 73
     						<!--  Certificate Name -->
73 74
     						<?php 
74 75
     						$name = $certificate->getCertificateDetails() ?: '';
76
+}
75 77
     						$sortname = "";
76 78
     						$ct_names=preg_match("/([A-Z]{2,})/", $name, $match);
77
-    						if($ct_names > 0) $sortname = $match[1].'_';
79
+    						if($ct_names > 0) {
80
+    							$sortname = $match[1].'_';
81
+    						}
78 82
     						$sortname .= $name;
79 83
     						?>
80 84
     						<td data-sort="<?= Filter::escapeHtml($sortname) ?>">
Please login to merge, or discard this patch.
src/Webtrees/Module/WelcomeBlockModule.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,9 +89,10 @@
 block discarded – undo
89 89
         $wb_controller = new WelcomeBlockController($this);
90 90
         try {
91 91
             return $wb_controller->config($block_id);
92
-        }
93
-        catch (MvcException $ex) {
94
-            if($ex->getHttpCode() != 200) throw $ex;
92
+        } catch (MvcException $ex) {
93
+            if($ex->getHttpCode() != 200) {
94
+            	throw $ex;
95
+            }
95 96
             return;
96 97
         }     
97 98
     }
Please login to merge, or discard this patch.
src/Webtrees/Module/WelcomeBlock/WelcomeBlockController.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,9 @@
 block discarded – undo
98 98
      */
99 99
     public function config($block_id = null) {
100 100
         
101
-        if(empty($block_id)) throw new MvcException(404);
101
+        if(empty($block_id)) {
102
+        	throw new MvcException(404);
103
+        }
102 104
 
103 105
         if (Filter::postBool('save') && Filter::checkCsrf()) {
104 106
             $this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled'));
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Views/SosaListFamView.php 1 patch
Braces   +3 added lines, -7 removed lines patch added patch discarded remove patch
@@ -293,10 +293,8 @@  discard block
 block discarded – undo
293 293
 						<?= I18N::number($family->getNumberOfChildren()) ?>
294 294
 					</td>
295 295
 					<td hidden><?php 
296
-					if (!$mdate->isOK()) { echo 'U'; }
297
-					else {
298
-					    if (Date::compare($mdate, new Date(date('Y') - 100)) > 0) { echo 'Y100'; }
299
-					    else { echo 'YES'; }
296
+					if (!$mdate->isOK()) { echo 'U'; } else {
297
+					    if (Date::compare($mdate, new Date(date('Y') - 100)) > 0) { echo 'Y100'; } else { echo 'YES'; }
300 298
 					}
301 299
 					if ($family->getFacts(WT_EVENTS_DIV)) { echo 'D'; }
302 300
 					if (count($husb->getSpouseFamilies()) > 1 || count($wife->getSpouseFamilies()) > 1) {
@@ -316,9 +314,7 @@  discard block
 block discarded – undo
316 314
         			if (!$husb->isDead() && !$wife->isDead()) { echo 'N'; } ?>
317 315
         			</td>
318 316
         			<td hidden><?php 
319
-			         if (!$husb->getChildFamilies() && !$wife->getChildFamilies()) { echo 'R'; }
320
-			         elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren() < 1) { echo 'L'; }
321
-			         else { echo '&nbsp;'; } ?>
317
+			         if (!$husb->getChildFamilies() && !$wife->getChildFamilies()) { echo 'R'; } elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren() < 1) { echo 'L'; } else { echo '&nbsp;'; } ?>
322 318
 			         </td>
323 319
 				</tr>
324 320
         	<?php } ?>
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Views/SosaListMissingView.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -184,7 +184,10 @@
 block discarded – undo
184 184
 							<td class="ui-state-default" colspan="11">
185 185
 								<div class="center">
186 186
 									<?= I18N::translate('Number of different missing ancestors: %s', I18N::number($this->data->get('missing_diff_count'))) ?>
187
-									<?php if($this->data->get('missing_hidden') > 0) echo ' ['. I18N::translate('%s hidden', I18N::number($this->data->get('missing_hidden'))).']'; ?>
187
+									<?php if($this->data->get('missing_hidden') > 0) {
188
+	echo ' ['. I18N::translate('%s hidden', I18N::number($this->data->get('missing_hidden'))).']';
189
+}
190
+?>
188 191
 									<?= ' - ' . I18N::translate('Generation complete at %s', I18N::percentage($this->data->get('perc_sosa'), 2)) ?>
189 192
 									<?= ' [' . I18N::translate('Potential %s', I18N::percentage($this->data->get('perc_sosa_potential'),2)).']' ?>
190 193
 								</div>
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Model/SosaProvider.php 1 patch
Braces   +74 added lines, -29 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 SQL_CACHE 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 SQL_CACHE 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 SQL_CACHE 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 SQL_CACHE 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 SQL_CACHE 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 SQL_CACHE 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 ('.
Please login to merge, or discard this patch.