Passed
Branch feature/2.0 (be78a0)
by Jonathan
11:57
created
src/Webtrees/Module/Sosa/Http/RequestHandlers/SosaConfigAction.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
         $params = $request->getParsedBody();
58 58
         assert(is_array($params));
59 59
 
60
-        $user_id = (int) $params['sosa-userid'];
60
+        $user_id = (int)$params['sosa-userid'];
61 61
         $root_id = $params['sosa-rootid'] ?? '';
62 62
 
63 63
         if (Auth::id() == $user_id || ($user_id == -1 && Auth::isManager($tree))) {
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Http/RequestHandlers/AncestorsListFamily.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
         $user = Auth::check() ? $request->getAttribute('user') : new DefaultUser();
80 80
 
81
-        $current_gen = (int) ($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0);
81
+        $current_gen = (int)($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0);
82 82
 
83 83
         if ($current_gen <= 0) {
84 84
             return response('Invalid generation', StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY);
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
         $nb_families_all = $list_families->count();
89 89
 
90 90
         /** @var \Illuminate\Support\Collection<int, \Fisharebest\Webtrees\Family> $list_families */
91
-        $list_families = $list_families->mapWithKeys(function (stdClass $value) use ($tree): ?array {
91
+        $list_families = $list_families->mapWithKeys(function(stdClass $value) use ($tree): ?array {
92 92
                 $fam = Registry::familyFactory()->make($value->f_id, $tree);
93
-                return ($fam !== null && $fam->canShow()) ? [(int) $value->majs_sosa => $fam] : null;
93
+                return ($fam !== null && $fam->canShow()) ? [(int)$value->majs_sosa => $fam] : null;
94 94
         })->filter();
95 95
 
96 96
         $nb_families_shown = $list_families->count();
97 97
 
98
-        return $this->viewResponse($this->module->name() . '::list-ancestors-fam-tab', [
98
+        return $this->viewResponse($this->module->name().'::list-ancestors-fam-tab', [
99 99
             'module_name'       =>  $this->module->name(),
100 100
             'title'             =>  I18N::translate('Sosa Ancestors'),
101 101
             'tree'              =>  $tree,
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Http/RequestHandlers/MissingAncestorsList.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -80,19 +80,19 @@  discard block
 block discarded – undo
80 80
         /** @var SosaStatisticsService $sosa_stats_service */
81 81
         $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]);
82 82
 
83
-        $current_gen = (int) ($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0);
83
+        $current_gen = (int)($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0);
84 84
 
85 85
         $list_missing = $this->sosa_record_service->listMissingAncestorsAtGeneration($tree, $user, $current_gen);
86
-        $nb_missing_diff = $list_missing->sum(function (stdClass $value): int {
86
+        $nb_missing_diff = $list_missing->sum(function(stdClass $value): int {
87 87
             return ($value->majs_fat_id === null ? 1 : 0) + ($value->majs_mot_id === null ? 1 : 0);
88 88
         });
89 89
 
90
-        $list_missing = $list_missing->map(function (stdClass $value) use ($tree): ?MissingAncestor {
90
+        $list_missing = $list_missing->map(function(stdClass $value) use ($tree): ?MissingAncestor {
91 91
             $indi = Registry::individualFactory()->make($value->majs_i_id, $tree);
92 92
             if ($indi !== null && $indi->canShowName()) {
93 93
                 return new MissingAncestor(
94 94
                     $indi,
95
-                    (int) $value->majs_sosa,
95
+                    (int)$value->majs_sosa,
96 96
                     $value->majs_fat_id === null,
97 97
                     $value->majs_mot_id === null
98 98
                 );
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
             return null;
101 101
         })->filter();
102 102
 
103
-        $nb_missing_shown = $list_missing->sum(function (MissingAncestor $value): int {
103
+        $nb_missing_shown = $list_missing->sum(function(MissingAncestor $value): int {
104 104
             return ($value->isFatherMissing() ? 1 : 0) + ($value->isMotherMissing() ? 1 : 0);
105 105
         });
106 106
 
107
-        return $this->viewResponse($this->module->name() . '::list-missing-page', [
107
+        return $this->viewResponse($this->module->name().'::list-missing-page', [
108 108
             'module_name'       =>  $this->module->name(),
109 109
             'title'             =>  I18N::translate('Missing Ancestors'),
110 110
             'tree'              =>  $tree,
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Http/RequestHandlers/AncestorsListIndividual.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
         $user = Auth::check() ? $request->getAttribute('user') : new DefaultUser();
80 80
 
81
-        $current_gen = (int) ($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0);
81
+        $current_gen = (int)($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0);
82 82
 
83 83
         if ($current_gen <= 0) {
84 84
             return response('Invalid generation', StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY);
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
         $nb_ancestors_all = $list_ancestors->count();
89 89
 
90 90
         /** @var \Illuminate\Support\Collection<int, \Fisharebest\Webtrees\Individual> $list_ancestors */
91
-        $list_ancestors = $list_ancestors->mapWithKeys(function (stdClass $value) use ($tree): ?array {
91
+        $list_ancestors = $list_ancestors->mapWithKeys(function(stdClass $value) use ($tree): ?array {
92 92
                 $indi = Registry::individualFactory()->make($value->majs_i_id, $tree);
93
-                return ($indi !== null && $indi->canShowName()) ? [(int) $value->majs_sosa => $indi] : null;
93
+                return ($indi !== null && $indi->canShowName()) ? [(int)$value->majs_sosa => $indi] : null;
94 94
         })->filter();
95 95
 
96 96
         $nb_ancestors_shown = $list_ancestors->count();
97 97
 
98
-        return $this->viewResponse($this->module->name() . '::list-ancestors-indi-tab', [
98
+        return $this->viewResponse($this->module->name().'::list-ancestors-indi-tab', [
99 99
             'module_name'       =>  $this->module->name(),
100 100
             'title'             =>  I18N::translate('Sosa Ancestors'),
101 101
             'tree'              =>  $tree,
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Http/RequestHandlers/SosaComputeModal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
         $tree = $request->getAttribute('tree');
61 61
         assert($tree instanceof Tree);
62 62
 
63
-        return response(view($this->module->name() . '::modals/sosa-compute', [
63
+        return response(view($this->module->name().'::modals/sosa-compute', [
64 64
             'tree'          => $tree,
65 65
             'xref'          =>  $request->getAttribute('xref')
66 66
         ]));
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Http/RequestHandlers/SosaComputeAction.php 1 patch
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
         $params = $request->getParsedBody();
59 59
         assert(is_array($params));
60 60
 
61
-        $user_id = (int) ($params['user_id'] ?? Auth::id() ?? 0);
61
+        $user_id = (int)($params['user_id'] ?? Auth::id() ?? 0);
62 62
         $partial_from = $params['partial_from'] ?? null;
63 63
 
64 64
         if (($user_id == -1 && Auth::isManager($tree)) || Auth::id() == $user_id) {
65 65
             $user = $user_id == -1 ? new DefaultUser() : $this->user_service->find($user_id);
66 66
 
67 67
             /** @var SosaCalculatorService $sosa_calc_service */
68
-            $sosa_calc_service = app()->makeWith(SosaCalculatorService::class, [ 'tree' => $tree, 'user' => $user]);
68
+            $sosa_calc_service = app()->makeWith(SosaCalculatorService::class, ['tree' => $tree, 'user' => $user]);
69 69
 
70 70
             if (
71 71
                 $partial_from !== null &&
@@ -77,8 +77,7 @@  discard block
 block discarded – undo
77 77
             }
78 78
 
79 79
             return $res ?
80
-                response('', 200) :
81
-                response(
80
+                response('', 200) : response(
82 81
                     I18N::translate('An error occurred while computing Sosa ancestors.'),
83 82
                     StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR
84 83
                 );
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Http/RequestHandlers/SosaConfig.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,12 +76,12 @@
 block discarded – undo
76 76
             }
77 77
         }
78 78
 
79
-        return $this->viewResponse($this->module->name() . '::config-page', [
79
+        return $this->viewResponse($this->module->name().'::config-page', [
80 80
             'module_name'       =>  $this->module->name(),
81 81
             'title'             =>  I18N::translate('Sosa Configuration'),
82 82
             'tree'              =>  $tree,
83 83
             'user_id'           =>  $request->getAttribute('user'),
84
-            'selected_user_id'  =>  (int) ($request->getQueryParams()['user_id'] ?? 0),
84
+            'selected_user_id'  =>  (int)($request->getQueryParams()['user_id'] ?? 0),
85 85
             'immediate_compute' =>  ($request->getQueryParams()['compute'] ?? '') == 'yes',
86 86
             'users_root'        =>  $users_root
87 87
         ]);
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Http/RequestHandlers/AncestorsList.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,9 +77,9 @@
 block discarded – undo
77 77
         /** @var SosaStatisticsService $sosa_stats_service */
78 78
         $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]);
79 79
 
80
-        $current_gen = (int) ($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0);
80
+        $current_gen = (int)($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0);
81 81
 
82
-        return $this->viewResponse($this->module->name() . '::list-ancestors-page', [
82
+        return $this->viewResponse($this->module->name().'::list-ancestors-page', [
83 83
             'module_name'       =>  $this->module->name(),
84 84
             'title'             =>  I18N::translate('Sosa Ancestors'),
85 85
             'tree'              =>  $tree,
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Http/RequestHandlers/SosaStatistics.php 1 patch
Spacing   +16 added lines, -19 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         /** @var SosaStatisticsService $sosa_stats_service */
70 70
         $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]);
71 71
 
72
-        return $this->viewResponse($this->module->name() . '::statistics-page', [
72
+        return $this->viewResponse($this->module->name().'::statistics-page', [
73 73
             'module_name'       =>  $this->module->name(),
74 74
             'title'             =>  I18N::translate('Sosa Statistics'),
75 75
             'tree'              =>  $tree,
@@ -122,31 +122,28 @@  discard block
 block discarded – undo
122 122
 
123 123
         foreach ($stats_by_gen as $gen => $stats_gen) {
124 124
             $gen_diff = $gen > 1 ?
125
-                (int) $stats_gen['diffSosaTotalCount'] - (int) $stats_by_gen[$gen - 1]['diffSosaTotalCount'] :
126
-                1;
125
+                (int)$stats_gen['diffSosaTotalCount'] - (int)$stats_by_gen[$gen - 1]['diffSosaTotalCount'] : 1;
127 126
             $generation_stats[$gen] = array(
128
-                'gen_min_birth' => $stats_gen['firstBirth'] ?? (int) $stats_gen['firstEstimatedBirth'],
129
-                'gen_max_birth' => $stats_gen['lastBirth'] ?? (int) $stats_gen['lastEstimatedBirth'],
127
+                'gen_min_birth' => $stats_gen['firstBirth'] ?? (int)$stats_gen['firstEstimatedBirth'],
128
+                'gen_max_birth' => $stats_gen['lastBirth'] ?? (int)$stats_gen['lastEstimatedBirth'],
130 129
                 'theoretical' => pow(2, $gen - 1),
131
-                'known' => (int) $stats_gen['sosaCount'],
132
-                'perc_known' => $this->safeDivision((int) $stats_gen['sosaCount'], pow(2, $gen - 1)),
130
+                'known' => (int)$stats_gen['sosaCount'],
131
+                'perc_known' => $this->safeDivision((int)$stats_gen['sosaCount'], pow(2, $gen - 1)),
133 132
                 'missing' => $gen > 1 ?
134
-                    2 * (int) $stats_by_gen[$gen - 1]['sosaCount'] - (int) $stats_gen['sosaCount'] :
135
-                    0,
133
+                    2 * (int)$stats_by_gen[$gen - 1]['sosaCount'] - (int)$stats_gen['sosaCount'] : 0,
136 134
                 'perc_missing' => $gen > 1 ?
137 135
                     1 - $this->safeDivision(
138
-                        (int) $stats_gen['sosaCount'],
139
-                        2 * (int) $stats_by_gen[$gen - 1]['sosaCount']
140
-                    ) :
141
-                    0,
142
-                'total_known' => (int) $stats_gen['sosaTotalCount'],
143
-                'perc_total_known' => $this->safeDivision((int) $stats_gen['sosaTotalCount'], pow(2, $gen) - 1),
136
+                        (int)$stats_gen['sosaCount'],
137
+                        2 * (int)$stats_by_gen[$gen - 1]['sosaCount']
138
+                    ) : 0,
139
+                'total_known' => (int)$stats_gen['sosaTotalCount'],
140
+                'perc_total_known' => $this->safeDivision((int)$stats_gen['sosaTotalCount'], pow(2, $gen) - 1),
144 141
                 'different' => $gen_diff,
145
-                'perc_different' => $this->safeDivision($gen_diff, (int) $stats_gen['sosaCount']),
146
-                'total_different' => (int) $stats_gen['diffSosaTotalCount'],
142
+                'perc_different' => $this->safeDivision($gen_diff, (int)$stats_gen['sosaCount']),
143
+                'total_different' => (int)$stats_gen['diffSosaTotalCount'],
147 144
                 'pedi_collapse' => 1 - $this->safeDivision(
148
-                    (int) $stats_gen['diffSosaTotalCount'],
149
-                    (int) $stats_gen['sosaTotalCount']
145
+                    (int)$stats_gen['diffSosaTotalCount'],
146
+                    (int)$stats_gen['sosaTotalCount']
150 147
                 )
151 148
             );
152 149
         }
Please login to merge, or discard this patch.