Completed
Pull Request — master (#1904)
by Rico
12:08
created
app/Functions/Functions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * webtrees: online genealogy
5 5
  * Copyright (C) 2018 webtrees development team
@@ -259,17 +259,17 @@  discard block
 block discarded – undo
259 259
             return false;
260 260
         }
261 261
 
262
-        $spouse_codes  = [
262
+        $spouse_codes = [
263 263
             'M' => 'hus',
264 264
             'F' => 'wif',
265 265
             'U' => 'spo',
266 266
         ];
267
-        $parent_codes  = [
267
+        $parent_codes = [
268 268
             'M' => 'fat',
269 269
             'F' => 'mot',
270 270
             'U' => 'par',
271 271
         ];
272
-        $child_codes   = [
272
+        $child_codes = [
273 273
             'M' => 'son',
274 274
             'F' => 'dau',
275 275
             'U' => 'chi',
Please login to merge, or discard this patch.
app/Stats.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * webtrees: online genealogy
5 5
  * Copyright (C) 2018 webtrees development team
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     private function getTags($text): array
158 158
     {
159 159
         // Extract all tags from the provided text
160
-        preg_match_all('/#([^#]+)(?=#)/', (string)$text, $match);
160
+        preg_match_all('/#([^#]+)(?=#)/', (string) $text, $match);
161 161
         $tags       = $match[1];
162 162
         $c          = count($tags);
163 163
         $new_tags   = []; // tag to replace
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
      */
394 394
     private function totalIndividualsQuery(): int
395 395
     {
396
-        return (int)Database::prepare(
396
+        return (int) Database::prepare(
397 397
             "SELECT COUNT(*) FROM `##individuals` WHERE i_file = :tree_id"
398 398
         )->execute([
399 399
             'tree_id' => $this->tree->getTreeId(),
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
      */
418 418
     private function totalIndisWithSourcesQuery(): int
419 419
     {
420
-        return (int)Database::prepare(
420
+        return (int) Database::prepare(
421 421
             "SELECT COUNT(DISTINCT i_id)" .
422 422
             " FROM `##individuals` JOIN `##link` ON i_id = l_from AND i_file = l_file" .
423 423
             " WHERE l_file = :tree_id AND l_type = 'SOUR'"
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
      */
501 501
     private function totalFamiliesQuery(): int
502 502
     {
503
-        return (int)Database::prepare(
503
+        return (int) Database::prepare(
504 504
             "SELECT COUNT(*) FROM `##families` WHERE f_file = :tree_id"
505 505
         )->execute([
506 506
             'tree_id' => $this->tree->getTreeId(),
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
      */
525 525
     private function totalFamsWithSourcesQuery(): int
526 526
     {
527
-        return (int)Database::prepare(
527
+        return (int) Database::prepare(
528 528
             "SELECT COUNT(DISTINCT f_id)" .
529 529
             " FROM `##families` JOIN `##link` ON f_id = l_from AND f_file = l_file" .
530 530
             " WHERE l_file = :tree_id AND l_type = 'SOUR'"
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
      */
608 608
     private function totalSourcesQuery(): int
609 609
     {
610
-        return (int)Database::prepare(
610
+        return (int) Database::prepare(
611 611
             "SELECT COUNT(*) FROM `##sources` WHERE s_file = :tree_id"
612 612
         )->execute([
613 613
             'tree_id' => $this->tree->getTreeId(),
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
      */
642 642
     private function totalNotesQuery(): int
643 643
     {
644
-        return (int)Database::prepare(
644
+        return (int) Database::prepare(
645 645
             "SELECT COUNT(*) FROM `##other` WHERE o_type='NOTE' AND o_file = :tree_id"
646 646
         )->execute([
647 647
             'tree_id' => $this->tree->getTreeId(),
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
      */
676 676
     private function totalRepositoriesQuery(): int
677 677
     {
678
-        return (int)Database::prepare(
678
+        return (int) Database::prepare(
679 679
             "SELECT COUNT(*) FROM `##other` WHERE o_type='REPO' AND o_file = :tree_id"
680 680
         )->execute([
681 681
             'tree_id' => $this->tree->getTreeId(),
@@ -786,11 +786,11 @@  discard block
 block discarded – undo
786 786
                 }
787 787
             }
788 788
             if ($types) {
789
-                $sql  .= ' AND d_fact IN (' . implode(', ', array_fill(0, count($types), '?')) . ')';
789
+                $sql .= ' AND d_fact IN (' . implode(', ', array_fill(0, count($types), '?')) . ')';
790 790
                 $vars = array_merge($vars, $types);
791 791
             }
792 792
         }
793
-        $sql  .= ' AND d_fact NOT IN (' . implode(', ', array_fill(0, count($no_types), '?')) . ')';
793
+        $sql .= ' AND d_fact NOT IN (' . implode(', ', array_fill(0, count($no_types), '?')) . ')';
794 794
         $vars = array_merge($vars, $no_types);
795 795
 
796 796
         $n = (int) Database::prepare($sql)->execute($vars)->fetchOne();
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
      */
903 903
     private function totalSexMalesQuery(): int
904 904
     {
905
-        return (int)Database::prepare(
905
+        return (int) Database::prepare(
906 906
             "SELECT COUNT(*) FROM `##individuals` WHERE i_file = :tree_id AND i_sex = 'M'"
907 907
         )->execute([
908 908
             'tree_id' => $this->tree->getTreeId(),
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
      */
937 937
     private function totalSexFemalesQuery(): int
938 938
     {
939
-        return (int)Database::prepare(
939
+        return (int) Database::prepare(
940 940
             "SELECT COUNT(*) FROM `##individuals` WHERE i_file = :tree_id AND i_sex = 'F'"
941 941
         )->execute([
942 942
             'tree_id' => $this->tree->getTreeId(),
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
      */
971 971
     private function totalSexUnknownQuery(): int
972 972
     {
973
-        return (int)Database::prepare(
973
+        return (int) Database::prepare(
974 974
             "SELECT COUNT(*) FROM `##individuals` WHERE i_file = :tree_id AND i_sex = 'U'"
975 975
         )->execute([
976 976
             'tree_id' => $this->tree->getTreeId(),
@@ -1042,12 +1042,12 @@  discard block
 block discarded – undo
1042 1042
         if ($tot == 0) {
1043 1043
             return '';
1044 1044
         } elseif ($tot_u > 0) {
1045
-            $chd         = $this->arrayToExtendedEncoding([
1045
+            $chd = $this->arrayToExtendedEncoding([
1046 1046
                 4095 * $tot_u / $tot,
1047 1047
                 4095 * $tot_f / $tot,
1048 1048
                 4095 * $tot_m / $tot,
1049 1049
             ]);
1050
-            $chl         =
1050
+            $chl =
1051 1051
                 I18N::translateContext('unknown people', 'Unknown') . ' - ' . $per_u . '|' .
1052 1052
                 I18N::translate('Females') . ' - ' . $per_f . '|' .
1053 1053
                 I18N::translate('Males') . ' - ' . $per_m;
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
 
1059 1059
             return "<img src=\"https://chart.googleapis.com/chart?cht=p3&amp;chd=e:{$chd}&amp;chs={$size}&amp;chco={$color_unknown},{$color_female},{$color_male}&amp;chf=bg,s,ffffff00&amp;chl={$chl}\" width=\"{$sizes[0]}\" height=\"{$sizes[1]}\" alt=\"" . $chart_title . '" title="' . $chart_title . '" />';
1060 1060
         } else {
1061
-            $chd         = $this->arrayToExtendedEncoding([
1061
+            $chd = $this->arrayToExtendedEncoding([
1062 1062
                 4095 * $tot_f / $tot,
1063 1063
                 4095 * $tot_m / $tot,
1064 1064
             ]);
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
      */
1085 1085
     private function totalLivingQuery(): int
1086 1086
     {
1087
-        return (int)Database::prepare(
1087
+        return (int) Database::prepare(
1088 1088
             "SELECT COUNT(*) FROM `##individuals` WHERE i_file = :tree_id AND i_gedcom NOT REGEXP '\\n1 (" . WT_EVENTS_DEAT . ")'"
1089 1089
         )->execute([
1090 1090
             'tree_id' => $this->tree->getTreeId(),
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
      */
1119 1119
     private function totalDeceasedQuery(): int
1120 1120
     {
1121
-        return (int)Database::prepare(
1121
+        return (int) Database::prepare(
1122 1122
             "SELECT COUNT(*) FROM `##individuals` WHERE i_file = :tree_id AND i_gedcom REGEXP '\\n1 (" . WT_EVENTS_DEAT . ")'"
1123 1123
         )->execute([
1124 1124
             'tree_id' => $this->tree->getTreeId(),
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
         if ($tot == 0) {
1184 1184
             return '';
1185 1185
         } else {
1186
-            $chd         = $this->arrayToExtendedEncoding([
1186
+            $chd = $this->arrayToExtendedEncoding([
1187 1187
                 4095 * $tot_l / $tot,
1188 1188
                 4095 * $tot_d / $tot,
1189 1189
             ]);
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
     public function totalUsers($params = []): string
1208 1208
     {
1209 1209
         if (isset($params[0])) {
1210
-            $total = count(User::all()) + (int)$params[0];
1210
+            $total = count(User::all()) + (int) $params[0];
1211 1211
         } else {
1212 1212
             $total = count(User::all());
1213 1213
         }
@@ -1254,18 +1254,18 @@  discard block
 block discarded – undo
1254 1254
             if ($type == 'unknown') {
1255 1255
                 // There has to be a better way then this :(
1256 1256
                 foreach ($this->media_types as $t) {
1257
-                    $sql    .= " AND (m_gedcom NOT LIKE ? AND m_gedcom NOT LIKE ?)";
1257
+                    $sql .= " AND (m_gedcom NOT LIKE ? AND m_gedcom NOT LIKE ?)";
1258 1258
                     $vars[] = "%3 TYPE {$t}%";
1259 1259
                     $vars[] = "%1 _TYPE {$t}%";
1260 1260
                 }
1261 1261
             } else {
1262
-                $sql    .= " AND (m_gedcom LIKE ? OR m_gedcom LIKE ?)";
1262
+                $sql .= " AND (m_gedcom LIKE ? OR m_gedcom LIKE ?)";
1263 1263
                 $vars[] = "%3 TYPE {$type}%";
1264 1264
                 $vars[] = "%1 _TYPE {$type}%";
1265 1265
             }
1266 1266
         }
1267 1267
 
1268
-        return (int)Database::prepare($sql)->execute($vars)->fetchOne();
1268
+        return (int) Database::prepare($sql)->execute($vars)->fetchOne();
1269 1269
     }
1270 1270
 
1271 1271
     /**
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
     private function totalPlacesQuery(): int
1727 1727
     {
1728 1728
         return
1729
-            (int)Database::prepare("SELECT COUNT(*) FROM `##places` WHERE p_file=?")
1729
+            (int) Database::prepare("SELECT COUNT(*) FROM `##places` WHERE p_file=?")
1730 1730
                 ->execute([$this->tree->getTreeId()])
1731 1731
                 ->fetchOne();
1732 1732
     }
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
         $chart_url .= '&amp;chs=' . $WT_STATS_MAP_X . 'x' . $WT_STATS_MAP_Y;
1897 1897
         $chart_url .= '&amp;chld=' . implode('', array_keys($surn_countries)) . '&amp;chd=s:';
1898 1898
         foreach ($surn_countries as $count) {
1899
-            $chart_url .= substr(self::GOOGLE_CHART_ENCODING, (int)($count / max($surn_countries) * 61), 1);
1899
+            $chart_url .= substr(self::GOOGLE_CHART_ENCODING, (int) ($count / max($surn_countries) * 61), 1);
1900 1900
         }
1901 1901
         $chart = '<div id="google_charts" class="center">';
1902 1902
         $chart .= '<p>' . $chart_title . '</p>';
@@ -1938,9 +1938,9 @@  discard block
 block discarded – undo
1938 1938
             $country = trim($place->country);
1939 1939
             if (array_key_exists($country, $country_names)) {
1940 1940
                 if (!isset($all_db_countries[$country_names[$country]][$country])) {
1941
-                    $all_db_countries[$country_names[$country]][$country] = (int)$place->tot;
1941
+                    $all_db_countries[$country_names[$country]][$country] = (int) $place->tot;
1942 1942
                 } else {
1943
-                    $all_db_countries[$country_names[$country]][$country] += (int)$place->tot;
1943
+                    $all_db_countries[$country_names[$country]][$country] += (int) $place->tot;
1944 1944
                 }
1945 1945
             }
1946 1946
         }
@@ -2117,7 +2117,7 @@  discard block
 block discarded – undo
2117 2117
             $centuries = '';
2118 2118
             $counts    = [];
2119 2119
             foreach ($rows as $values) {
2120
-                $counts[]  = round(100 * $values->total / $tot, 0);
2120
+                $counts[] = round(100 * $values->total / $tot, 0);
2121 2121
                 $centuries .= $this->centuryName($values->century) . ' - ' . I18N::number((int) $values->total) . '|';
2122 2122
             }
2123 2123
             $chd = $this->arrayToExtendedEncoding($counts);
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
             $centuries = '';
2212 2212
             $counts    = [];
2213 2213
             foreach ($rows as $values) {
2214
-                $counts[]  = round(100 * $values->total / $tot, 0);
2214
+                $counts[] = round(100 * $values->total / $tot, 0);
2215 2215
                 $centuries .= $this->centuryName($values->century) . ' - ' . I18N::number((int) $values->total) . '|';
2216 2216
             }
2217 2217
             $chd = $this->arrayToExtendedEncoding($counts);
@@ -2461,7 +2461,7 @@  discard block
 block discarded – undo
2461 2461
                 }
2462 2462
                 break;
2463 2463
             case 'age':
2464
-                $result = I18N::number((int)($row->age / 365.25));
2464
+                $result = I18N::number((int) ($row->age / 365.25));
2465 2465
                 break;
2466 2466
             case 'name':
2467 2467
                 $result = '<a href="' . e($person->url()) . '">' . $person->getFullName() . '</a>';
@@ -2490,7 +2490,7 @@  discard block
 block discarded – undo
2490 2490
             $sex_search = '';
2491 2491
         }
2492 2492
         if (isset($params[0])) {
2493
-            $total = (int)$params[0];
2493
+            $total = (int) $params[0];
2494 2494
         } else {
2495 2495
             $total = 10;
2496 2496
         }
@@ -2524,10 +2524,10 @@  discard block
 block discarded – undo
2524 2524
         foreach ($rows as $row) {
2525 2525
             $person = Individual::getInstance($row->deathdate, $this->tree);
2526 2526
             $age    = $row->age;
2527
-            if ((int)($age / 365.25) > 0) {
2528
-                $age = (int)($age / 365.25) . 'y';
2529
-            } elseif ((int)($age / 30.4375) > 0) {
2530
-                $age = (int)($age / 30.4375) . 'm';
2527
+            if ((int) ($age / 365.25) > 0) {
2528
+                $age = (int) ($age / 365.25) . 'y';
2529
+            } elseif ((int) ($age / 30.4375) > 0) {
2530
+                $age = (int) ($age / 30.4375) . 'm';
2531 2531
             } else {
2532 2532
                 $age = $age . 'd';
2533 2533
             }
@@ -2589,11 +2589,11 @@  discard block
 block discarded – undo
2589 2589
             $sex_search = '';
2590 2590
         }
2591 2591
         if (isset($params[0])) {
2592
-            $total = (int)$params[0];
2592
+            $total = (int) $params[0];
2593 2593
         } else {
2594 2594
             $total = 10;
2595 2595
         }
2596
-        $rows  = $this->runSql(
2596
+        $rows = $this->runSql(
2597 2597
             "SELECT" .
2598 2598
             " birth.d_gid AS id," .
2599 2599
             " MIN(birth.d_julianday1) AS age" .
@@ -2616,10 +2616,10 @@  discard block
 block discarded – undo
2616 2616
         foreach ($rows as $row) {
2617 2617
             $person = Individual::getInstance($row->id, $this->tree);
2618 2618
             $age    = (WT_CLIENT_JD - $row->age);
2619
-            if ((int)($age / 365.25) > 0) {
2620
-                $age = (int)($age / 365.25) . 'y';
2621
-            } elseif ((int)($age / 30.4375) > 0) {
2622
-                $age = (int)($age / 30.4375) . 'm';
2619
+            if ((int) ($age / 365.25) > 0) {
2620
+                $age = (int) ($age / 365.25) . 'y';
2621
+            } elseif ((int) ($age / 30.4375) > 0) {
2622
+                $age = (int) ($age / 30.4375) . 'm';
2623 2623
             } else {
2624 2624
                 $age = $age . 'd';
2625 2625
             }
@@ -2696,10 +2696,10 @@  discard block
 block discarded – undo
2696 2696
 
2697 2697
         $age = $rows[0]->age;
2698 2698
         if ($show_years) {
2699
-            if ((int)($age / 365.25) > 0) {
2700
-                $age = (int)($age / 365.25) . 'y';
2701
-            } elseif ((int)($age / 30.4375) > 0) {
2702
-                $age = (int)($age / 30.4375) . 'm';
2699
+            if ((int) ($age / 365.25) > 0) {
2700
+                $age = (int) ($age / 365.25) . 'y';
2701
+            } elseif ((int) ($age / 30.4375) > 0) {
2702
+                $age = (int) ($age / 30.4375) . 'm';
2703 2703
             } elseif (!empty($age)) {
2704 2704
                 $age = $age . 'd';
2705 2705
             }
@@ -2769,7 +2769,7 @@  discard block
 block discarded – undo
2769 2769
                 if ($sizes[0] < 980) {
2770 2770
                     $sizes[0] += 50;
2771 2771
                 }
2772
-                $chxl    .= $this->centuryName($century) . '|';
2772
+                $chxl .= $this->centuryName($century) . '|';
2773 2773
                 $average = 0;
2774 2774
                 if (isset($values['F'])) {
2775 2775
                     $countsf .= $values['F'] . ',';
@@ -2811,7 +2811,7 @@  discard block
 block discarded – undo
2811 2811
                 while ($offset = strpos($title, ' ', $offset + 1)) {
2812 2812
                     $counter[] = $offset;
2813 2813
                 }
2814
-                $half = (int)(count($counter) / 2);
2814
+                $half = (int) (count($counter) / 2);
2815 2815
                 $chtt = substr_replace($title, '|', $counter[$half], 1);
2816 2816
             }
2817 2817
 
@@ -3387,16 +3387,16 @@  discard block
 block discarded – undo
3387 3387
             case 'age':
3388 3388
                 $age = $row->age;
3389 3389
                 if ($show_years) {
3390
-                    if ((int)($age / 365.25) > 0) {
3391
-                        $age = (int)($age / 365.25) . 'y';
3392
-                    } elseif ((int)($age / 30.4375) > 0) {
3393
-                        $age = (int)($age / 30.4375) . 'm';
3390
+                    if ((int) ($age / 365.25) > 0) {
3391
+                        $age = (int) ($age / 365.25) . 'y';
3392
+                    } elseif ((int) ($age / 30.4375) > 0) {
3393
+                        $age = (int) ($age / 30.4375) . 'm';
3394 3394
                     } else {
3395 3395
                         $age = $age . 'd';
3396 3396
                     }
3397 3397
                     $result = FunctionsDate::getAgeAtEvent($age);
3398 3398
                 } else {
3399
-                    $result = I18N::number((int)($age / 365.25));
3399
+                    $result = I18N::number((int) ($age / 365.25));
3400 3400
                 }
3401 3401
                 break;
3402 3402
         }
@@ -3416,7 +3416,7 @@  discard block
 block discarded – undo
3416 3416
     private function ageOfMarriageQuery(string $type = 'list', string $age_dir = 'ASC', array $params = []): string
3417 3417
     {
3418 3418
         if (isset($params[0])) {
3419
-            $total = (int)$params[0];
3419
+            $total = (int) $params[0];
3420 3420
         } else {
3421 3421
             $total = 10;
3422 3422
         }
@@ -3499,10 +3499,10 @@  discard block
 block discarded – undo
3499 3499
             if ($type === 'name') {
3500 3500
                 return $family->formatList();
3501 3501
             }
3502
-            if ((int)($age / 365.25) > 0) {
3503
-                $age = (int)($age / 365.25) . 'y';
3504
-            } elseif ((int)($age / 30.4375) > 0) {
3505
-                $age = (int)($age / 30.4375) . 'm';
3502
+            if ((int) ($age / 365.25) > 0) {
3503
+                $age = (int) ($age / 365.25) . 'y';
3504
+            } elseif ((int) ($age / 30.4375) > 0) {
3505
+                $age = (int) ($age / 30.4375) . 'm';
3506 3506
             } else {
3507 3507
                 $age = $age . 'd';
3508 3508
             }
@@ -3564,7 +3564,7 @@  discard block
 block discarded – undo
3564 3564
     private function ageBetweenSpousesQuery($type = 'list', $age_dir = 'DESC', $params = []): string
3565 3565
     {
3566 3566
         if (isset($params[0])) {
3567
-            $total = (int)$params[0];
3567
+            $total = (int) $params[0];
3568 3568
         } else {
3569 3569
             $total = 10;
3570 3570
         }
@@ -3609,10 +3609,10 @@  discard block
 block discarded – undo
3609 3609
                 break;
3610 3610
             }
3611 3611
             $age = $fam->age;
3612
-            if ((int)($age / 365.25) > 0) {
3613
-                $age = (int)($age / 365.25) . 'y';
3614
-            } elseif ((int)($age / 30.4375) > 0) {
3615
-                $age = (int)($age / 30.4375) . 'm';
3612
+            if ((int) ($age / 365.25) > 0) {
3613
+                $age = (int) ($age / 365.25) . 'y';
3614
+            } elseif ((int) ($age / 30.4375) > 0) {
3615
+                $age = (int) ($age / 30.4375) . 'm';
3616 3616
             } else {
3617 3617
                 $age = $age . 'd';
3618 3618
             }
@@ -3700,16 +3700,16 @@  discard block
 block discarded – undo
3700 3700
             case 'age':
3701 3701
                 $age = $row->age;
3702 3702
                 if ($show_years) {
3703
-                    if ((int)($age / 365.25) > 0) {
3704
-                        $age = (int)($age / 365.25) . 'y';
3705
-                    } elseif ((int)($age / 30.4375) > 0) {
3706
-                        $age = (int)($age / 30.4375) . 'm';
3703
+                    if ((int) ($age / 365.25) > 0) {
3704
+                        $age = (int) ($age / 365.25) . 'y';
3705
+                    } elseif ((int) ($age / 30.4375) > 0) {
3706
+                        $age = (int) ($age / 30.4375) . 'm';
3707 3707
                     } else {
3708 3708
                         $age = $age . 'd';
3709 3709
                     }
3710 3710
                     $result = FunctionsDate::getAgeAtEvent($age);
3711 3711
                 } else {
3712
-                    $result = (int)($age / 365.25);
3712
+                    $result = (int) ($age / 365.25);
3713 3713
                 }
3714 3714
                 break;
3715 3715
         }
@@ -3793,7 +3793,7 @@  discard block
 block discarded – undo
3793 3793
             $sizes = explode('x', $size);
3794 3794
             $tot   = 0;
3795 3795
             foreach ($rows as $values) {
3796
-                $tot += (int)$values->total;
3796
+                $tot += (int) $values->total;
3797 3797
             }
3798 3798
             // Beware divide by zero
3799 3799
             if ($tot === 0) {
@@ -3802,7 +3802,7 @@  discard block
 block discarded – undo
3802 3802
             $centuries = '';
3803 3803
             $counts    = [];
3804 3804
             foreach ($rows as $values) {
3805
-                $counts[]  = round(100 * $values->total / $tot, 0);
3805
+                $counts[] = round(100 * $values->total / $tot, 0);
3806 3806
                 $centuries .= $this->centuryName($values->century) . ' - ' . I18N::number((int) $values->total) . '|';
3807 3807
             }
3808 3808
             $chd = $this->arrayToExtendedEncoding($counts);
@@ -3898,7 +3898,7 @@  discard block
 block discarded – undo
3898 3898
             $centuries = '';
3899 3899
             $counts    = [];
3900 3900
             foreach ($rows as $values) {
3901
-                $counts[]  = round(100 * $values->total / $tot, 0);
3901
+                $counts[] = round(100 * $values->total / $tot, 0);
3902 3902
                 $centuries .= $this->centuryName($values->century) . ' - ' . I18N::number((int) $values->total) . '|';
3903 3903
             }
3904 3904
             $chd = $this->arrayToExtendedEncoding($counts);
@@ -4167,7 +4167,7 @@  discard block
 block discarded – undo
4167 4167
                 if ($sizes[0] < 1000) {
4168 4168
                     $sizes[0] += 50;
4169 4169
                 }
4170
-                $chxl    .= $this->centuryName($century) . '|';
4170
+                $chxl .= $this->centuryName($century) . '|';
4171 4171
                 $average = 0;
4172 4172
                 if (isset($values['F'])) {
4173 4173
                     if ($max <= 50) {
@@ -4224,7 +4224,7 @@  discard block
 block discarded – undo
4224 4224
                 while ($offset = strpos(I18N::translate('Average age in century of marriage'), ' ', $offset + 1)) {
4225 4225
                     $counter[] = $offset;
4226 4226
                 }
4227
-                $half = (int)(count($counter) / 2);
4227
+                $half = (int) (count($counter) / 2);
4228 4228
                 $chtt = substr_replace(I18N::translate('Average age in century of marriage'), '|', $counter[$half], 1);
4229 4229
             }
4230 4230
 
@@ -4760,7 +4760,7 @@  discard block
 block discarded – undo
4760 4760
     private function topTenFamilyQuery($type = 'list', $params = []): string
4761 4761
     {
4762 4762
         if (isset($params[0])) {
4763
-            $total = (int)$params[0];
4763
+            $total = (int) $params[0];
4764 4764
         } else {
4765 4765
             $total = 10;
4766 4766
         }
@@ -4827,7 +4827,7 @@  discard block
 block discarded – undo
4827 4827
     private function ageBetweenSiblingsQuery($type = 'list', $params = []): string
4828 4828
     {
4829 4829
         if (isset($params[0])) {
4830
-            $total = (int)$params[0];
4830
+            $total = (int) $params[0];
4831 4831
         } else {
4832 4832
             $total = 10;
4833 4833
         }
@@ -4883,10 +4883,10 @@  discard block
 block discarded – undo
4883 4883
                 return $return;
4884 4884
             }
4885 4885
             $age = $fam->age;
4886
-            if ((int)($age / 365.25) > 0) {
4887
-                $age = (int)($age / 365.25) . 'y';
4888
-            } elseif ((int)($age / 30.4375) > 0) {
4889
-                $age = (int)($age / 30.4375) . 'm';
4886
+            if ((int) ($age / 365.25) > 0) {
4887
+                $age = (int) ($age / 365.25) . 'y';
4888
+            } elseif ((int) ($age / 30.4375) > 0) {
4889
+                $age = (int) ($age / 30.4375) . 'm';
4890 4890
             } else {
4891 4891
                 $age = $age . 'd';
4892 4892
             }
@@ -4897,7 +4897,7 @@  discard block
 block discarded – undo
4897 4897
             if ($type == 'list') {
4898 4898
                 if ($one && !in_array($fam->family, $dist)) {
4899 4899
                     if ($child1->canShow() && $child2->canShow()) {
4900
-                        $return  = '<li>';
4900
+                        $return = '<li>';
4901 4901
                         $return  .= '<a href="' . e($child2->url()) . '">' . $child2->getFullName() . '</a> ';
4902 4902
                         $return  .= I18N::translate('and') . ' ';
4903 4903
                         $return  .= '<a href="' . e($child1->url()) . '">' . $child1->getFullName() . '</a>';
@@ -4908,7 +4908,7 @@  discard block
 block discarded – undo
4908 4908
                         $dist[]  = $fam->family;
4909 4909
                     }
4910 4910
                 } elseif (!$one && $child1->canShow() && $child2->canShow()) {
4911
-                    $return  = '<li>';
4911
+                    $return = '<li>';
4912 4912
                     $return  .= '<a href="' . e($child2->url()) . '">' . $child2->getFullName() . '</a> ';
4913 4913
                     $return  .= I18N::translate('and') . ' ';
4914 4914
                     $return  .= '<a href="' . e($child1->url()) . '">' . $child1->getFullName() . '</a>';
@@ -5183,7 +5183,7 @@  discard block
 block discarded – undo
5183 5183
             $total = 10;
5184 5184
         }
5185 5185
         $sizes = explode('x', $size);
5186
-        $total = (int)$total;
5186
+        $total = (int) $total;
5187 5187
         $rows  = $this->runSql(
5188 5188
             " SELECT f_numchil AS tot, f_id AS id" .
5189 5189
             " FROM `##families`" .
@@ -5196,7 +5196,7 @@  discard block
 block discarded – undo
5196 5196
         }
5197 5197
         $tot = 0;
5198 5198
         foreach ($rows as $row) {
5199
-            $tot += (int)$row->tot;
5199
+            $tot += (int) $row->tot;
5200 5200
         }
5201 5201
         $chd = '';
5202 5202
         $chl = [];
@@ -5208,7 +5208,7 @@  discard block
 block discarded – undo
5208 5208
                 } else {
5209 5209
                     $per = round(100 * $row->tot / $tot, 0);
5210 5210
                 }
5211
-                $chd   .= $this->arrayToExtendedEncoding([$per]);
5211
+                $chd .= $this->arrayToExtendedEncoding([$per]);
5212 5212
                 $chl[] = htmlspecialchars_decode(strip_tags($family->getFullName())) . ' - ' . I18N::number($row->tot);
5213 5213
             }
5214 5214
         }
@@ -5554,7 +5554,7 @@  discard block
 block discarded – undo
5554 5554
             if ($max < $values->count) {
5555 5555
                 $max = $values->count;
5556 5556
             }
5557
-            $tot += (int)$values->count;
5557
+            $tot += (int) $values->count;
5558 5558
         }
5559 5559
         $unknown = $this->noChildrenFamiliesQuery() - $tot;
5560 5560
         if ($unknown > $max) {
@@ -5578,13 +5578,13 @@  discard block
 block discarded – undo
5578 5578
         $chm      .= 't' . $unknown . ',000000,0,' . $i . ',11,1';
5579 5579
         $chxl     .= I18N::translateContext('unknown century', 'Unknown') . '|1:||' . I18N::translate('century') . '|2:|0|';
5580 5580
         $step     = $max + 1;
5581
-        for ($d = (int)($max + 1); $d > 0; $d--) {
5581
+        for ($d = (int) ($max + 1); $d > 0; $d--) {
5582 5582
             if (($max + 1) < ($d * 10 + 1) && fmod(($max + 1), $d) == 0) {
5583 5583
                 $step = $d;
5584 5584
             }
5585 5585
         }
5586
-        if ($step == (int)($max + 1)) {
5587
-            for ($d = (int)($max); $d > 0; $d--) {
5586
+        if ($step == (int) ($max + 1)) {
5587
+            for ($d = (int) ($max); $d > 0; $d--) {
5588 5588
                 if ($max < ($d * 10 + 1) && fmod($max, $d) == 0) {
5589 5589
                     $step = $d;
5590 5590
                 }
@@ -5609,7 +5609,7 @@  discard block
 block discarded – undo
5609 5609
     private function topTenGrandFamilyQuery($type = 'list', $params = []): string
5610 5610
     {
5611 5611
         if (isset($params[0])) {
5612
-            $total = (int)$params[0];
5612
+            $total = (int) $params[0];
5613 5613
         } else {
5614 5614
             $total = 10;
5615 5615
         }
@@ -5707,8 +5707,8 @@  discard block
 block discarded – undo
5707 5707
      */
5708 5708
     private function commonSurnamesQuery($type = 'list', $show_tot = false, $params = []): string
5709 5709
     {
5710
-        $threshold          = empty($params[0]) ? 10 : (int)$params[0];
5711
-        $number_of_surnames = empty($params[1]) ? 10 : (int)$params[1];
5710
+        $threshold          = empty($params[0]) ? 10 : (int) $params[0];
5711
+        $number_of_surnames = empty($params[1]) ? 10 : (int) $params[1];
5712 5712
         $sorting            = empty($params[2]) ? 'alpha' : $params[2];
5713 5713
 
5714 5714
         $surnames = $this->topSurnames($number_of_surnames, $threshold);
@@ -5869,7 +5869,7 @@  discard block
 block discarded – undo
5869 5869
             $max_name  = 0;
5870 5870
             $top_name  = '';
5871 5871
             foreach ($surns as $spfxsurn => $count) {
5872
-                $per       = $count;
5872
+                $per = $count;
5873 5873
                 $count_per += $per;
5874 5874
                 // select most common surname from all variants
5875 5875
                 if ($per > $max_name) {
@@ -5893,11 +5893,11 @@  discard block
 block discarded – undo
5893 5893
                     ], $top_name);
5894 5894
             }
5895 5895
             $per   = round(100 * $count_per / $tot_indi, 0);
5896
-            $chd   .= $this->arrayToExtendedEncoding([$per]);
5896
+            $chd .= $this->arrayToExtendedEncoding([$per]);
5897 5897
             $chl[] = $top_name . ' - ' . I18N::number($count_per);
5898 5898
         }
5899 5899
         $per   = round(100 * ($tot_indi - $tot) / $tot_indi, 0);
5900
-        $chd   .= $this->arrayToExtendedEncoding([$per]);
5900
+        $chd .= $this->arrayToExtendedEncoding([$per]);
5901 5901
         $chl[] = I18N::translate('Other') . ' - ' . I18N::number($tot_indi - $tot);
5902 5902
 
5903 5903
         $chart_title = implode(I18N::$list_separator, $chl);
@@ -5919,12 +5919,12 @@  discard block
 block discarded – undo
5919 5919
     private function commonGivenQuery($sex = 'B', $type = 'list', $show_tot = false, $params = [])
5920 5920
     {
5921 5921
         if (isset($params[0]) && $params[0] != '' && $params[0] >= 0) {
5922
-            $threshold = (int)$params[0];
5922
+            $threshold = (int) $params[0];
5923 5923
         } else {
5924 5924
             $threshold = 1;
5925 5925
         }
5926 5926
         if (isset($params[1]) && $params[1] != '' && $params[1] >= 0) {
5927
-            $maxtoshow = (int)$params[1];
5927
+            $maxtoshow = (int) $params[1];
5928 5928
         } else {
5929 5929
             $maxtoshow = 10;
5930 5930
         }
@@ -6317,11 +6317,11 @@  discard block
 block discarded – undo
6317 6317
             } else {
6318 6318
                 $per = round(100 * $count / $tot_indi, 0);
6319 6319
             }
6320
-            $chd   .= $this->arrayToExtendedEncoding([$per]);
6320
+            $chd .= $this->arrayToExtendedEncoding([$per]);
6321 6321
             $chl[] = $givn . ' - ' . I18N::number($count);
6322 6322
         }
6323 6323
         $per   = round(100 * ($tot_indi - $tot) / $tot_indi, 0);
6324
-        $chd   .= $this->arrayToExtendedEncoding([$per]);
6324
+        $chd .= $this->arrayToExtendedEncoding([$per]);
6325 6325
         $chl[] = I18N::translate('Other') . ' - ' . I18N::number($tot_indi - $tot);
6326 6326
 
6327 6327
         $chart_title = implode(I18N::$list_separator, $chl);
@@ -6548,7 +6548,7 @@  discard block
 block discarded – undo
6548 6548
                     $datestamp = I18N::dateFormat();
6549 6549
                 }
6550 6550
 
6551
-                return FunctionsDate::timestampToGedcomDate((int)$user->getPreference('reg_timestamp'))->display(false, $datestamp);
6551
+                return FunctionsDate::timestampToGedcomDate((int) $user->getPreference('reg_timestamp'))->display(false, $datestamp);
6552 6552
             case 'regtime':
6553 6553
                 if (is_array($params) && isset($params[0]) && $params[0] != '') {
6554 6554
                     $datestamp = $params[0];
@@ -6556,7 +6556,7 @@  discard block
 block discarded – undo
6556 6556
                     $datestamp = str_replace('%', '', I18N::timeFormat());
6557 6557
                 }
6558 6558
 
6559
-                return date($datestamp, (int)$user->getPreference('reg_timestamp'));
6559
+                return date($datestamp, (int) $user->getPreference('reg_timestamp'));
6560 6560
             case 'loggedin':
6561 6561
                 if (is_array($params) && isset($params[0]) && $params[0] != '') {
6562 6562
                     $yes = $params[0];
@@ -6896,9 +6896,9 @@  discard block
 block discarded – undo
6896 6896
             if ($value < 0) {
6897 6897
                 $value = 0;
6898 6898
             }
6899
-            $first    = (int)($value / 64);
6899
+            $first    = (int) ($value / 64);
6900 6900
             $second   = $value % 64;
6901
-            $encoding .= $xencoding[(int)$first] . $xencoding[(int)$second];
6901
+            $encoding .= $xencoding[(int) $first] . $xencoding[(int) $second];
6902 6902
         }
6903 6903
 
6904 6904
         return $encoding;
@@ -7042,7 +7042,7 @@  discard block
 block discarded – undo
7042 7042
      */
7043 7043
     public function totalUserMessages(): string
7044 7044
     {
7045
-        $total = (int)Database::prepare("SELECT COUNT(*) FROM `##message` WHERE user_id = ?")
7045
+        $total = (int) Database::prepare("SELECT COUNT(*) FROM `##message` WHERE user_id = ?")
7046 7046
             ->execute([Auth::id()])
7047 7047
             ->fetchOne();
7048 7048
 
@@ -7057,7 +7057,7 @@  discard block
 block discarded – undo
7057 7057
     public function totalUserJournal(): string
7058 7058
     {
7059 7059
         try {
7060
-            $number = (int)Database::prepare("SELECT COUNT(*) FROM `##news` WHERE user_id = ?")
7060
+            $number = (int) Database::prepare("SELECT COUNT(*) FROM `##news` WHERE user_id = ?")
7061 7061
                 ->execute([Auth::id()])
7062 7062
                 ->fetchOne();
7063 7063
         } catch (PDOException $ex) {
@@ -7078,7 +7078,7 @@  discard block
 block discarded – undo
7078 7078
     public function totalGedcomNews(): string
7079 7079
     {
7080 7080
         try {
7081
-            $number = (int)Database::prepare("SELECT COUNT(*) FROM `##news` WHERE gedcom_id = ?")
7081
+            $number = (int) Database::prepare("SELECT COUNT(*) FROM `##news` WHERE gedcom_id = ?")
7082 7082
                 ->execute([$this->tree->getTreeId()])
7083 7083
                 ->fetchOne();
7084 7084
         } catch (PDOException $ex) {
Please login to merge, or discard this patch.
app/Services/UpgradeService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * webtrees: online genealogy
5 5
  * Copyright (C) 2018 webtrees development team
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $latest_version = $this->fetchLatestVersion();
76 76
 
77
-        list(, , $url) = explode('|', $latest_version . '||');
77
+        list(,, $url) = explode('|', $latest_version . '||');
78 78
 
79 79
         return $url;
80 80
     }
Please login to merge, or discard this patch.
app/Date.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * webtrees: online genealogy
5 5
  * Copyright (C) 2018 webtrees development team
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
      */
450 450
     public function julianDay(): int
451 451
     {
452
-        return (int)(($this->minimumJulianDay() + $this->maximumJulianDay()) / 2);
452
+        return (int) (($this->minimumJulianDay() + $this->maximumJulianDay()) / 2);
453 453
     }
454 454
 
455 455
     /**
Please login to merge, or discard this patch.
app/Module/InteractiveTree/TreeView.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * webtrees: online genealogy
5 5
  * Copyright (C) 2018 webtrees development team
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
         // Fixing the width for td to the box initial width when the person is the root person fix a rare bug that happen when a person without child and without known parents is the root person : an unwanted white rectangle appear at the right of the person’s boxes, otherwise.
256 256
         $html .= '<td' . ($isRoot ? ' style="width:1px"' : '') . '><div class="tv_box' . ($isRoot ? ' rootPerson' : '') . '" dir="' . I18N::direction() . '" style="text-align: ' . (I18N::direction() === 'rtl' ? 'right' : 'left') . '; direction: ' . I18N::direction() . '" abbr="' . $person->getXref() . '" onclick="' . $this->name . 'Handler.expandBox(this, event);">';
257 257
         $html .= $this->drawPersonName($person);
258
-        $fop  = []; // $fop is fathers of partners
258
+        $fop = []; // $fop is fathers of partners
259 259
         if ($partner !== null) {
260 260
             $dashed = '';
261 261
             foreach ($person->getSpouseFamilies() as $family) {
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
                             $spouse_parents,
274 274
                         ];
275 275
                     }
276
-                    $html   .= $this->drawPersonName($spouse, $dashed);
276
+                    $html .= $this->drawPersonName($spouse, $dashed);
277 277
                     $dashed = 'dashed';
278 278
                 }
279 279
             }
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
         /* draw the parents */
294 294
         if ($state >= 0 && (!empty($parent) || count($fop))) {
295 295
             $unique = (empty($parent) || count($fop) == 0);
296
-            $html   .= '<td align="left"><table class="tv_tree"><tbody>';
296
+            $html .= '<td align="left"><table class="tv_tree"><tbody>';
297 297
             if (!empty($parent)) {
298
-                $u    = $unique ? 'c' : 't';
298
+                $u = $unique ? 'c' : 't';
299 299
                 $html .= '<tr><td ' . ($gen == 0 ? ' abbr="p' . $primaryChildFamily->getXref() . '@' . $u . '"' : '') . '>';
300 300
                 $html .= $this->drawPerson($parent, $gen - 1, 1, $primaryChildFamily, $u);
301 301
                 $html .= '</td></tr>';
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                 $nb = count($fop);
306 306
                 foreach ($fop as $p) {
307 307
                     $n++;
308
-                    $u    = $unique ? 'c' : ($n == $nb || empty($p[1]) ? 'b' : 'h');
308
+                    $u = $unique ? 'c' : ($n == $nb || empty($p[1]) ? 'b' : 'h');
309 309
                     $html .= '<tr><td ' . ($gen == 0 ? ' abbr="p' . $p[1]->getXref() . '@' . $u . '"' : '') . '>' . $this->drawPerson($p[0], $gen - 1, 1, $p[1], $u) . '</td></tr>';
310 310
                 }
311 311
             }
Please login to merge, or discard this patch.
app/Module/OnThisDayModule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * webtrees: online genealogy
5 5
  * Copyright (C) 2018 webtrees development team
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
         $default_events = implode(',', self::DEFAULT_EVENTS);
110 110
 
111
-        $filter    = (bool)$this->getBlockSetting($block_id, 'filter', '1');
111
+        $filter    = (bool) $this->getBlockSetting($block_id, 'filter', '1');
112 112
         $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
113 113
         $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
114 114
         $events    = $this->getBlockSetting($block_id, 'events', $default_events);
Please login to merge, or discard this patch.
app/Module/LoginBlockModule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * webtrees: online genealogy
5 5
  * Copyright (C) 2018 webtrees development team
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         } else {
62 62
             $title   = I18N::translate('Sign in');
63 63
             $content = view('modules/login_block/sign-in', [
64
-                'allow_register' => (bool)Site::getPreference('USE_REGISTRATION_MODULE'),
64
+                'allow_register' => (bool) Site::getPreference('USE_REGISTRATION_MODULE'),
65 65
             ]);
66 66
         }
67 67
 
Please login to merge, or discard this patch.
app/Module/TopPageViewsModule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * webtrees: online genealogy
5 5
  * Copyright (C) 2018 webtrees development team
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             " ORDER BY page_count DESC LIMIT :limit"
78 78
         )->execute([
79 79
             'tree_id' => $tree->getTreeId(),
80
-            'limit'   => (int)$num,
80
+            'limit'   => (int) $num,
81 81
         ])->fetchAssoc();
82 82
 
83 83
         $content = '<table>';
Please login to merge, or discard this patch.
app/Module/AbstractModule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * webtrees: online genealogy
5 5
  * Copyright (C) 2018 webtrees development team
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         if ($access_level === null) {
228 228
             return $this->defaultAccessLevel();
229 229
         } else {
230
-            return (int)$access_level;
230
+            return (int) $access_level;
231 231
         }
232 232
     }
233 233
 
Please login to merge, or discard this patch.