Passed
Branch feature/2.1-geodispersion-dev (1d61a8)
by Jonathan
61:21
created
src/Webtrees/Module/AdminTasks/Http/RequestHandlers/TaskEditAction.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             return redirect($admin_config_route);
73 73
         }
74 74
 
75
-        $task_sched_id = (int) $request->getAttribute('task');
75
+        $task_sched_id = (int)$request->getAttribute('task');
76 76
         $task_schedule = $this->taskschedules_service->find($task_sched_id);
77 77
 
78 78
         if ($task_schedule === null) {
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                 'success'
93 93
             );
94 94
             //phpcs:ignore Generic.Files.LineLength.TooLong
95
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” has been updated.');
95
+            Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” has been updated.');
96 96
         }
97 97
 
98 98
         return redirect($admin_config_route);
@@ -111,17 +111,17 @@  discard block
 block discarded – undo
111 111
             return false;
112 112
         }
113 113
 
114
-        $params = (array) $request->getParsedBody();
114
+        $params = (array)$request->getParsedBody();
115 115
 
116
-        $frequency = (int) $params['frequency'];
116
+        $frequency = (int)$params['frequency'];
117 117
         if ($frequency > 0) {
118 118
             $task_schedule->setFrequency(CarbonInterval::minutes($frequency));
119 119
         } else {
120 120
             FlashMessages::addMessage(I18N::translate('The frequency is not in a valid format'), 'danger');
121 121
         }
122 122
 
123
-        $is_limited = (bool) $params['is_limited'];
124
-        $nb_occur = (int) $params['nb_occur'];
123
+        $is_limited = (bool)$params['is_limited'];
124
+        $nb_occur = (int)$params['nb_occur'];
125 125
 
126 126
         if ($is_limited) {
127 127
             if ($nb_occur > 0) {
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
         FlashMessages::addMessage(I18N::translate('An error occured while updating the scheduled task'), 'danger');
153 153
         //@phpcs:ignore Generic.Files.LineLength.TooLong
154
-        Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” could not be updated. See error log.');
154
+        Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” could not be updated. See error log.');
155 155
         return false;
156 156
     }
157 157
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
                 'danger'
184 184
             );
185 185
             //phpcs:ignore Generic.Files.LineLength.TooLong
186
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : AdminTask “' . $task->name() . '” specific settings could not be updated. See error log.');
186
+            Log::addConfigurationLog('Module '.$this->module->title().' : AdminTask “'.$task->name().'” specific settings could not be updated. See error log.');
187 187
         }
188 188
 
189 189
         return true;
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Http/RequestHandlers/TaskStatusAction.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             return redirect($admin_config_route);
69 69
         }
70 70
 
71
-        $task_sched_id = (int) $request->getAttribute('task');
71
+        $task_sched_id = (int)$request->getAttribute('task');
72 72
         $task_schedule = $this->taskschedules_service->find($task_sched_id);
73 73
 
74 74
         $admin_config_route = route(AdminConfigPage::class);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             return redirect($admin_config_route);
82 82
         }
83 83
 
84
-        ((bool) $request->getAttribute('enable', false)) ? $task_schedule->enable() : $task_schedule->disable();
84
+        ((bool)$request->getAttribute('enable', false)) ? $task_schedule->enable() : $task_schedule->disable();
85 85
 
86 86
         if ($this->taskschedules_service->update($task_schedule) > 0) {
87 87
             FlashMessages::addMessage(
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
                 'success'
90 90
             );
91 91
             //phpcs:ignore Generic.Files.LineLength.TooLong
92
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” has been updated.');
92
+            Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” has been updated.');
93 93
         } else {
94 94
             FlashMessages::addMessage(
95 95
                 I18N::translate('An error occured while updating the scheduled task'),
96 96
                 'danger'
97 97
             );
98 98
             //phpcs:ignore Generic.Files.LineLength.TooLong
99
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” could not be updated. See error log.');
99
+            Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” could not be updated. See error log.');
100 100
         }
101 101
 
102 102
         return redirect($admin_config_route);
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Tasks/HealthCheckEmailTask.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         $interval_lastrun = $task_schedule->lastRunTime()->diffAsCarbonInterval(Carbon::now());
137 137
         //@phpcs:ignore Generic.Files.LineLength.TooLong
138 138
         $interval = $interval_lastrun->greaterThan($task_schedule->frequency()) ? $interval_lastrun : $task_schedule->frequency();
139
-        $nb_days = (int) $interval->ceilDay()->totalDays;
139
+        $nb_days = (int)$interval->ceilDay()->totalDays;
140 140
 
141 141
         $view_params_site = [
142 142
             'nb_days'               =>  $nb_days,
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                 continue;
156 156
             }
157 157
 
158
-            $webmaster = $this->user_service->find((int) $tree->getPreference('WEBMASTER_USER_ID'));
158
+            $webmaster = $this->user_service->find((int)$tree->getPreference('WEBMASTER_USER_ID'));
159 159
             if ($webmaster === null) {
160 160
                 continue;
161 161
             }
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
                 new TreeUser($tree),
177 177
                 $webmaster,
178 178
                 new NoReplyUser(),
179
-                I18N::translate('Health Check Report') . ' - ' . I18N::translate('Tree %s', $tree->name()),
180
-                view($this->module->name() . '::tasks/healthcheck/email-healthcheck-text', $view_params),
181
-                view($this->module->name() . '::tasks/healthcheck/email-healthcheck-html', $view_params)
179
+                I18N::translate('Health Check Report').' - '.I18N::translate('Tree %s', $tree->name()),
180
+                view($this->module->name().'::tasks/healthcheck/email-healthcheck-text', $view_params),
181
+                view($this->module->name().'::tasks/healthcheck/email-healthcheck-html', $view_params)
182 182
             );
183 183
         }
184 184
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public function configView(ServerRequestInterface $request): string
193 193
     {
194
-        return $this->module === null ? '' : view($this->module->name() . '::tasks/healthcheck/config', [
194
+        return $this->module === null ? '' : view($this->module->name().'::tasks/healthcheck/config', [
195 195
             'all_trees'     =>  $this->tree_service->all()
196 196
         ]);
197 197
     }
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
     public function updateConfig(ServerRequestInterface $request, TaskSchedule $task_schedule): bool
204 204
     {
205 205
         try {
206
-            $params = (array) $request->getParsedBody();
206
+            $params = (array)$request->getParsedBody();
207 207
 
208 208
             foreach ($this->tree_service->all() as $tree) {
209 209
                 if (Auth::isManager($tree)) {
210
-                    $tree_enabled = (bool) ($params['HEALTHCHECK_ENABLED_' . $tree->id()] ?? false);
210
+                    $tree_enabled = (bool)($params['HEALTHCHECK_ENABLED_'.$tree->id()] ?? false);
211 211
                     $tree->setPreference(self::TREE_PREFERENCE_NAME, $tree_enabled ? '1' : '0');
212 212
                 }
213 213
             }
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Services/TaskScheduleService.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
         $query = DB::table('maj_admintasks')
198 198
             ->select()
199 199
             ->where('majat_status', '=', 'enabled')
200
-            ->where(function (Builder $query): void {
200
+            ->where(function(Builder $query): void {
201 201
 
202 202
                 $query->where('majat_running', '=', 0)
203 203
                 ->orWhere('majat_last_run', '<=', Carbon::now()->subSeconds(self::TASK_TIME_OUT));
204 204
             });
205 205
 
206 206
         if (!$force) {
207
-            $query->where(function (Builder $query): void {
207
+            $query->where(function(Builder $query): void {
208 208
 
209 209
                 $query->where('majat_running', '=', 0)
210 210
                     ->orWhereRaw('DATE_ADD(majat_last_run, INTERVAL majat_frequency MINUTE) <= NOW()');
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
                     $task_schedule->setLastResult($task->run($task_schedule));
254 254
                 } catch (Throwable $ex) {
255 255
                     if ($first_error) { // Only record the first error, as this could fill the log.
256
-                        Log::addErrorLog(I18N::translate('Error while running task %s:', $task->name()) . ' ' .
257
-                            '[' . get_class($ex) . '] ' . $ex->getMessage() . ' ' . $ex->getFile() . ':'
258
-                            . $ex->getLine() . PHP_EOL . $ex->getTraceAsString());
256
+                        Log::addErrorLog(I18N::translate('Error while running task %s:', $task->name()).' '.
257
+                            '['.get_class($ex).'] '.$ex->getMessage().' '.$ex->getFile().':'
258
+                            . $ex->getLine().PHP_EOL.$ex->getTraceAsString());
259 259
                     }
260 260
                 }
261 261
 
@@ -276,17 +276,17 @@  discard block
 block discarded – undo
276 276
      */
277 277
     public static function rowMapper(): Closure
278 278
     {
279
-        return static function (stdClass $row): TaskSchedule {
279
+        return static function(stdClass $row): TaskSchedule {
280 280
 
281 281
             return new TaskSchedule(
282
-                (int) $row->majat_id,
282
+                (int)$row->majat_id,
283 283
                 $row->majat_task_id,
284 284
                 $row->majat_status === 'enabled',
285 285
                 Carbon::parse($row->majat_last_run),
286
-                (bool) $row->majat_last_result,
286
+                (bool)$row->majat_last_result,
287 287
                 CarbonInterval::minutes($row->majat_frequency),
288
-                (int) $row->majat_nb_occur,
289
-                (bool) $row->majat_running
288
+                (int)$row->majat_nb_occur,
289
+                (bool)$row->majat_running
290 290
             );
291 291
         };
292 292
     }
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->getQueryParams()['gen'] ?? $request->getAttribute('gen') ?? 0);
80
+        $current_gen = (int)($request->getQueryParams()['gen'] ?? $request->getAttribute('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/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') ?? 0);
81
+        $current_gen = (int)($request->getAttribute('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/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') ?? 0);
81
+        $current_gen = (int)($request->getAttribute('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->getQueryParams()['gen'] ?? $request->getAttribute('gen') ?? 0);
83
+        $current_gen = (int)($request->getQueryParams()['gen'] ?? $request->getAttribute('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/GeoAnalyses/SosaByGenerationGeoAnalysis.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
             if ($ancestor === null || !$ancestor->canShow()) {
79 79
                 continue;
80 80
             }
81
-            $generation = $this->records_service->generation((int) $item->majs_sosa);
81
+            $generation = $this->records_service->generation((int)$item->majs_sosa);
82 82
             $significantplace = new GeoAnalysisPlace($tree, null, $depth);
83 83
             foreach ($this->significantPlaces($ancestor) as $place) {
84 84
                 $significantplace = new GeoAnalysisPlace($tree, $place, $depth, true);
Please login to merge, or discard this patch.