Passed
Branch main (f9aaf7)
by Jonathan
14:43
created
app/Module/AdminTasks/Http/RequestHandlers/TasksList.php 1 patch
Spacing   +10 added lines, -12 removed lines patch added patch discarded remove patch
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
         $module = $this->module;
62 62
         $module_name = $this->module->name();
63 63
         return response(['data' => $this->taskschedules_service->all(true, true)
64
-            ->map(function (TaskSchedule $schedule) use ($module, $module_name): array {
64
+            ->map(function(TaskSchedule $schedule) use ($module, $module_name): array {
65 65
                 $task = $this->taskschedules_service->findTask($schedule->taskId());
66 66
                 $task_name = $task !== null ? $task->name() : I18N::translate('Task not found');
67 67
 
68 68
                 return [
69
-                    'edit' =>   view($module_name . '::admin/tasks-table-options', [
69
+                    'edit' =>   view($module_name.'::admin/tasks-table-options', [
70 70
                         'task_sched_id' => $schedule->id(),
71 71
                         'task_sched_enabled' => $schedule->isEnabled(),
72 72
                         'task_edit_route' => route(TaskEditPage::class, ['task' => $schedule->id()]),
@@ -76,37 +76,35 @@  discard block
 block discarded – undo
76 76
                         ])
77 77
                     ]),
78 78
                     'status'    =>  [
79
-                        'display'   =>  view($module_name . '::components/yes-no-icons', [
79
+                        'display'   =>  view($module_name.'::components/yes-no-icons', [
80 80
                             'yes' => $schedule->isEnabled()
81 81
                         ]),
82 82
                         'raw'       =>  $schedule->isEnabled() ? 1 : 0
83 83
                     ],
84 84
                     'task_name' =>  [
85
-                        'display'   =>  '<span dir="auto">' . e($task_name) . '</span>',
85
+                        'display'   =>  '<span dir="auto">'.e($task_name).'</span>',
86 86
                         'raw'       =>  $task_name
87 87
                     ],
88 88
                     'last_run'  =>  [
89 89
                         'display'   =>  $schedule->lastRunTime()->unix() === 0 ?
90
-                            view('components/datetime', ['timestamp' => $schedule->lastRunTime()]) :
91
-                            view('components/datetime-diff', ['timestamp' => $schedule->lastRunTime()]),
90
+                            view('components/datetime', ['timestamp' => $schedule->lastRunTime()]) : view('components/datetime-diff', ['timestamp' => $schedule->lastRunTime()]),
92 91
                         'raw'       =>  $schedule->lastRunTime()->unix()
93 92
                     ],
94 93
                     'last_result'   =>  [
95
-                        'display'   => view($module_name . '::components/yes-no-icons', [
94
+                        'display'   => view($module_name.'::components/yes-no-icons', [
96 95
                             'yes' => $schedule->wasLastRunSuccess()
97 96
                         ]),
98 97
                         'raw'       =>  $schedule->wasLastRunSuccess() ? 1 : 0
99 98
                     ],
100
-                    'frequency' =>  '<span dir="auto">' . e($schedule->frequency()->cascade()->forHumans()) . '</span>',
99
+                    'frequency' =>  '<span dir="auto">'.e($schedule->frequency()->cascade()->forHumans()).'</span>',
101 100
                     'nb_occurrences'    =>  $schedule->remainingOccurences() > 0 ?
102
-                        I18N::number($schedule->remainingOccurences()) :
103
-                        I18N::translate('Unlimited'),
104
-                    'running'   =>  view($module_name . '::components/yes-no-icons', [
101
+                        I18N::number($schedule->remainingOccurences()) : I18N::translate('Unlimited'),
102
+                    'running'   =>  view($module_name.'::components/yes-no-icons', [
105 103
                         'yes' => $schedule->isRunning(),
106 104
                         'text_yes' => I18N::translate('Running'),
107 105
                         'text_no' => I18N::translate('Not running')
108 106
                     ]),
109
-                    'run'       =>  view($module_name . '::admin/tasks-table-run', [
107
+                    'run'       =>  view($module_name.'::admin/tasks-table-run', [
110 108
                         'task_sched_id' => $schedule->id(),
111 109
                         'run_route' => route(TaskTrigger::class, [
112 110
                             'task'  =>  $schedule->taskId(),
Please login to merge, or discard this patch.
app/Module/AdminTasks/Http/RequestHandlers/TaskEditAction.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             return redirect($admin_config_route);
65 65
         }
66 66
 
67
-        $task_sched_id = (int) $request->getAttribute('task');
67
+        $task_sched_id = (int)$request->getAttribute('task');
68 68
         $task_schedule = $this->taskschedules_service->find($task_sched_id);
69 69
 
70 70
         if ($task_schedule === null) {
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                 'success'
85 85
             );
86 86
             //phpcs:ignore Generic.Files.LineLength.TooLong
87
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” has been updated.');
87
+            Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” has been updated.');
88 88
         }
89 89
 
90 90
         return redirect($admin_config_route);
@@ -103,17 +103,17 @@  discard block
 block discarded – undo
103 103
             return false;
104 104
         }
105 105
 
106
-        $params = (array) $request->getParsedBody();
106
+        $params = (array)$request->getParsedBody();
107 107
 
108
-        $frequency = (int) $params['frequency'];
108
+        $frequency = (int)$params['frequency'];
109 109
         if ($frequency > 0) {
110 110
             $task_schedule->setFrequency(CarbonInterval::minutes($frequency));
111 111
         } else {
112 112
             FlashMessages::addMessage(I18N::translate('The frequency is not in a valid format.'), 'danger');
113 113
         }
114 114
 
115
-        $is_limited = (bool) $params['is_limited'];
116
-        $nb_occur = (int) $params['nb_occur'];
115
+        $is_limited = (bool)$params['is_limited'];
116
+        $nb_occur = (int)$params['nb_occur'];
117 117
 
118 118
         if ($is_limited) {
119 119
             if ($nb_occur > 0) {
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
         FlashMessages::addMessage(I18N::translate('An error occured while updating the scheduled task.'), 'danger');
145 145
         //@phpcs:ignore Generic.Files.LineLength.TooLong
146
-        Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” could not be updated. See error log.');
146
+        Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” could not be updated. See error log.');
147 147
         return false;
148 148
     }
149 149
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
                 'danger'
176 176
             );
177 177
             //phpcs:ignore Generic.Files.LineLength.TooLong
178
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : AdminTask “' . $task->name() . '” specific settings could not be updated. See error log.');
178
+            Log::addConfigurationLog('Module '.$this->module->title().' : AdminTask “'.$task->name().'” specific settings could not be updated. See error log.');
179 179
         }
180 180
 
181 181
         return true;
Please login to merge, or discard this patch.
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/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/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/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/Common/Hooks/AbstractHookCollector.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
      */
58 58
     public function name(): string
59 59
     {
60
-        return $this->module->name() . '-' .
60
+        return $this->module->name().'-'.
61 61
             mb_substr(str_replace('collector', '', mb_strtolower((new ReflectionClass($this))->getShortName())), 0, 64);
62 62
     }
63 63
 
Please login to merge, or discard this patch.
app/Common/GeoDispersion/GeoAnalysis/GeoAnalysisResult.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public function merge(GeoAnalysisResult $other): self
136 136
     {
137
-        $this->places->each(function (GeoAnalysisResultItem $item) use ($other): void {
137
+        $this->places->each(function(GeoAnalysisResultItem $item) use ($other): void {
138 138
             if ($other->places->has($item->key())) {
139 139
                 $item->place()->exclude(
140 140
                     $item->place()->isExcluded()
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             }
144 144
         });
145 145
 
146
-        $other->places->each(function (GeoAnalysisResultItem $item): void {
146
+        $other->places->each(function(GeoAnalysisResultItem $item): void {
147 147
             if (!$this->places->has($item->key())) {
148 148
                 $this->addPlace($item->place());
149 149
             }
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
     public function sortedKnownPlaces(bool $exclude_other = false): Collection
231 231
     {
232 232
         return $this->knownPlaces($exclude_other)->sortBy([
233
-            fn (GeoAnalysisResultItem $a, GeoAnalysisResultItem $b): int => $b->count() <=> $a->count(),
234
-            fn (GeoAnalysisResultItem $a, GeoAnalysisResultItem $b): int =>
233
+            fn(GeoAnalysisResultItem $a, GeoAnalysisResultItem $b): int => $b->count() <=> $a->count(),
234
+            fn(GeoAnalysisResultItem $a, GeoAnalysisResultItem $b): int =>
235 235
                 I18N::comparator()($a->place()->place()->gedcomName(), $b->place()->place()->gedcomName())
236 236
         ]);
237 237
     }
Please login to merge, or discard this patch.