Passed
Push — main ( f9aaf7...4197a4 )
by Jonathan
14:34
created
app/Module/AdminTasks/Http/RequestHandlers/TaskStatusAction.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             return redirect($admin_config_route);
61 61
         }
62 62
 
63
-        $task_sched_id = (int) $request->getAttribute('task');
63
+        $task_sched_id = (int)$request->getAttribute('task');
64 64
         $task_schedule = $this->taskschedules_service->find($task_sched_id);
65 65
 
66 66
         $admin_config_route = route(AdminConfigPage::class);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             return redirect($admin_config_route);
74 74
         }
75 75
 
76
-        ((bool) $request->getAttribute('enable', false)) ? $task_schedule->enable() : $task_schedule->disable();
76
+        ((bool)$request->getAttribute('enable', false)) ? $task_schedule->enable() : $task_schedule->disable();
77 77
 
78 78
         if ($this->taskschedules_service->update($task_schedule) > 0) {
79 79
             FlashMessages::addMessage(
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
                 'success'
82 82
             );
83 83
             //phpcs:ignore Generic.Files.LineLength.TooLong
84
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” has been updated.');
84
+            Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” has been updated.');
85 85
         } else {
86 86
             FlashMessages::addMessage(
87 87
                 I18N::translate('An error occured while updating the scheduled task.'),
88 88
                 'danger'
89 89
             );
90 90
             //phpcs:ignore Generic.Files.LineLength.TooLong
91
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” could not be updated. See error log.');
91
+            Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” could not be updated. See error log.');
92 92
         }
93 93
 
94 94
         return redirect($admin_config_route);
Please login to merge, or discard this patch.
app/Module/AdminTasks/Http/RequestHandlers/AdminConfigPage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
             $this->module->setPreference('PAT_FORCE_EXEC_TOKEN', $token);
74 74
         }
75 75
         
76
-        return $this->viewResponse($this->module->name() . '::admin/config', [
76
+        return $this->viewResponse($this->module->name().'::admin/config', [
77 77
             'title'             =>  $this->module->title(),
78 78
             'trigger_token'     =>  $token,
79 79
             'trigger_route'     =>  route(TaskTrigger::class, ['task' => '__TASKNAME__', 'force' => '__TOKEN__']),
Please login to merge, or discard this patch.
app/Module/AdminTasks/Http/RequestHandlers/TaskEditPage.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
60 60
         }
61 61
 
62
-        $task_sched_id = (int) $request->getAttribute('task');
62
+        $task_sched_id = (int)$request->getAttribute('task');
63 63
         $task_schedule = $this->taskschedules_service->find($task_sched_id);
64 64
 
65 65
         if ($task_schedule === null) {
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
         $has_task_config = $task instanceof ConfigurableTaskInterface;
76 76
         /** @var \MyArtJaub\Webtrees\Contracts\Tasks\TaskInterface&\MyArtJaub\Webtrees\Contracts\Tasks\ConfigurableTaskInterface $task */
77 77
 
78
-        return $this->viewResponse($this->module->name() . '::admin/tasks-edit', [
78
+        return $this->viewResponse($this->module->name().'::admin/tasks-edit', [
79 79
             'module'            =>  $this->module,
80
-            'title'             =>  I18N::translate('Edit the administrative task') . ' - ' . $task->name(),
80
+            'title'             =>  I18N::translate('Edit the administrative task').' - '.$task->name(),
81 81
             'task_schedule'     =>  $task_schedule,
82 82
             'task'              =>  $task,
83 83
             'has_task_config'   =>  $has_task_config,
Please login to merge, or discard this patch.
app/Module/AdminTasks/Http/RequestHandlers/TokenGenerate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 
57 57
         $token = $this->token_service->generateRandomToken();
58 58
         $this->module->setPreference('MAJ_AT_FORCE_EXEC_TOKEN', $token);
59
-        Log::addConfigurationLog($this->module->title() . ' : New token generated.');
59
+        Log::addConfigurationLog($this->module->title().' : New token generated.');
60 60
 
61 61
         return response(['token' => $token]);
62 62
     }
Please login to merge, or discard this patch.
app/Module/AdminTasks/Schema/Migration1.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
         // Clean up previous admin tasks table if it exists
35 35
         DB::schema()->dropIfExists('maj_admintasks');
36 36
 
37
-        DB::schema()->create('maj_admintasks', static function (Blueprint $table): void {
37
+        DB::schema()->create('maj_admintasks', static function(Blueprint $table): void {
38 38
 
39 39
             $table->increments('majat_id');
40 40
             $table->string('majat_task_id', 32)->unique();
Please login to merge, or discard this patch.
app/Module/AdminTasks/Services/TaskScheduleService.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function available(): Collection
101 101
     {
102
-        return Registry::cache()->array()->remember('maj-available-admintasks', function () {
102
+        return Registry::cache()->array()->remember('maj-available-admintasks', function() {
103 103
             return $this->module_service
104 104
                 ->findByInterface(ModuleTasksProviderInterface::class)
105 105
                 ->flatMap(fn(ModuleTasksProviderInterface $module) => $module->listTasks());
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
         $query = DB::table('maj_admintasks')
202 202
             ->select()
203 203
             ->where('majat_status', '=', 'enabled')
204
-            ->where(function (Builder $query): void {
204
+            ->where(function(Builder $query): void {
205 205
 
206 206
                 $query->where('majat_running', '=', 0)
207 207
                 ->orWhere('majat_last_run', '<=', Carbon::now()->subSeconds(self::TASK_TIME_OUT));
208 208
             });
209 209
 
210 210
         if (!$force) {
211
-            $query->where(function (Builder $query): void {
211
+            $query->where(function(Builder $query): void {
212 212
 
213 213
                 $query->where('majat_running', '=', 0)
214 214
                     ->orWhereRaw('DATE_ADD(majat_last_run, INTERVAL majat_frequency MINUTE) <= NOW()');
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
                     $task_schedule->setLastResult($task->run($task_schedule));
257 257
                 } catch (Throwable $ex) {
258 258
                     if ($first_error) { // Only record the first error, as this could fill the log.
259
-                        Log::addErrorLog(I18N::translate('Error while running task %s:', $task->name()) . ' ' .
260
-                            '[' . get_class($ex) . '] ' . $ex->getMessage() . ' ' . $ex->getFile() . ':'
261
-                            . $ex->getLine() . PHP_EOL . $ex->getTraceAsString());
259
+                        Log::addErrorLog(I18N::translate('Error while running task %s:', $task->name()).' '.
260
+                            '['.get_class($ex).'] '.$ex->getMessage().' '.$ex->getFile().':'
261
+                            . $ex->getLine().PHP_EOL.$ex->getTraceAsString());
262 262
                     }
263 263
                 }
264 264
 
@@ -279,17 +279,17 @@  discard block
 block discarded – undo
279 279
      */
280 280
     public static function rowMapper(): Closure
281 281
     {
282
-        return static function (stdClass $row): TaskSchedule {
282
+        return static function(stdClass $row): TaskSchedule {
283 283
 
284 284
             return new TaskSchedule(
285
-                (int) $row->majat_id,
285
+                (int)$row->majat_id,
286 286
                 $row->majat_task_id,
287 287
                 $row->majat_status === 'enabled',
288 288
                 Carbon::parse($row->majat_last_run),
289
-                (bool) $row->majat_last_result,
289
+                (bool)$row->majat_last_result,
290 290
                 CarbonInterval::minutes($row->majat_frequency),
291
-                (int) $row->majat_nb_occur,
292
-                (bool) $row->majat_running
291
+                (int)$row->majat_nb_occur,
292
+                (bool)$row->majat_running
293 293
             );
294 294
         };
295 295
     }
Please login to merge, or discard this patch.
app/Module/AdminTasks/Services/HealthCheckService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     public function changesByRecordType(Tree $tree, int $nb_days): Collection
80 80
     {
81 81
         return DB::table('change')
82
-            ->joinSub($this->allGedcomRecords($tree), 'gedrecords', function (JoinClause $join) use ($tree): void {
82
+            ->joinSub($this->allGedcomRecords($tree), 'gedrecords', function(JoinClause $join) use ($tree): void {
83 83
 
84 84
                 $join->on('change.xref', '=', 'gedrecords.ged_id')
85 85
                     ->where('change.gedcom_id', '=', $tree->id());
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                 new Expression('MAX(log_time) AS lastoccurred')
116 116
             )
117 117
             ->where('log_type', '=', 'error')
118
-            ->where(function (Builder $query) use ($tree): void {
118
+            ->where(function(Builder $query) use ($tree): void {
119 119
                 $query->where('gedcom_id', '=', $tree->id())
120 120
                     ->orWhereNull('gedcom_id');
121 121
             })
Please login to merge, or discard this patch.
app/Module/AdminTasks/AdminTasksModule.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     //How to update the database schema for this module
56 56
     private const SCHEMA_TARGET_VERSION   = 2;
57 57
     private const SCHEMA_SETTING_NAME     = 'MAJ_ADMTASKS_SCHEMA_VERSION';
58
-    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
58
+    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__.'\Schema';
59 59
 
60 60
     /**
61 61
      * {@inheritDoc}
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function loadRoutes(Map $router): void
97 97
     {
98
-        $router->attach('', '', static function (Map $router): void {
98
+        $router->attach('', '', static function(Map $router): void {
99 99
 
100
-            $router->attach('', '/module-maj/admintasks', static function (Map $router): void {
100
+            $router->attach('', '/module-maj/admintasks', static function(Map $router): void {
101 101
                 $router->tokens(['enable' => '[01]']);
102 102
 
103
-                $router->attach('', '/admin', static function (Map $router): void {
103
+                $router->attach('', '/admin', static function(Map $router): void {
104 104
 
105 105
                     $router->extras([
106 106
                         'middleware' => [
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                     ]);
110 110
                     $router->get(AdminConfigPage::class, '/config', AdminConfigPage::class);
111 111
 
112
-                    $router->attach('', '/tasks', static function (Map $router): void {
112
+                    $router->attach('', '/tasks', static function(Map $router): void {
113 113
 
114 114
                         $router->get(TasksList::class, '', TasksList::class);
115 115
                         $router->get(TaskEditPage::class, '/{task}', TaskEditPage::class);
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function bodyContent(): string
153 153
     {
154
-        return view($this->name() . '::snippet', [ 'url' => route(TaskTrigger::class) ]);
154
+        return view($this->name().'::snippet', ['url' => route(TaskTrigger::class)]);
155 155
     }
156 156
 
157 157
     /**
Please login to merge, or discard this patch.
app/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.