Passed
Branch feature/2.0 (ef99fd)
by Jonathan
11:25
created
src/Webtrees/Module/AdminTasks/Http/RequestHandlers/TaskStatusAction.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function handle(ServerRequestInterface $request): ResponseInterface
60 60
     {
61
-        $task_sched_id = (int) $request->getAttribute('task');
61
+        $task_sched_id = (int)$request->getAttribute('task');
62 62
         $task_schedule = $this->taskschedules_service->find($task_sched_id);
63 63
         
64 64
         $admin_config_route = route(AdminConfigPage::class);
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             return redirect($admin_config_route);
72 72
         }
73 73
         
74
-        ((bool) $request->getAttribute('enable', false)) ? $task_schedule->enable() : $task_schedule->disable();
74
+        ((bool)$request->getAttribute('enable', false)) ? $task_schedule->enable() : $task_schedule->disable();
75 75
         
76 76
         if ($this->taskschedules_service->update($task_schedule) > 0) {
77 77
             FlashMessages::addMessage(
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
                 'success'
80 80
             );
81 81
             //phpcs:ignore Generic.Files.LineLength.TooLong
82
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” has been updated.');
82
+            Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” has been updated.');
83 83
         } else {
84 84
             FlashMessages::addMessage(
85 85
                 I18N::translate('An error occured while updating the scheduled task'),
86 86
                 'danger'
87 87
             );
88 88
             //phpcs:ignore Generic.Files.LineLength.TooLong
89
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” could not be updated. See error log.');
89
+            Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” could not be updated. See error log.');
90 90
         }
91 91
         
92 92
         return redirect($admin_config_route);
Please login to merge, or discard this patch.
src/Webtrees/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 = Functions::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.
src/Webtrees/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.
src/Webtrees/Module/AdminTasks/Http/RequestHandlers/TaskEditAction.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function handle(ServerRequestInterface $request): ResponseInterface
64 64
     {
65
-        $task_sched_id = (int) $request->getAttribute('task');
65
+        $task_sched_id = (int)$request->getAttribute('task');
66 66
         $task_schedule = $this->taskschedules_service->find($task_sched_id);
67 67
         
68 68
         $admin_config_route = route(AdminConfigPage::class);
@@ -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);
@@ -99,17 +99,17 @@  discard block
 block discarded – undo
99 99
      */
100 100
     private function updateGeneralSettings(TaskSchedule $task_schedule, ServerRequestInterface $request): bool
101 101
     {
102
-        $params = (array) $request->getParsedBody();
102
+        $params = (array)$request->getParsedBody();
103 103
         
104
-        $frequency = (int) $params['frequency'];
104
+        $frequency = (int)$params['frequency'];
105 105
         if ($frequency > 0) {
106 106
             $task_schedule->setFrequency(CarbonInterval::minutes($frequency));
107 107
         } else {
108 108
             FlashMessages::addMessage(I18N::translate('The frequency is not in a valid format'), 'danger');
109 109
         }
110 110
         
111
-        $is_limited = (bool) $params['is_limited'];
112
-        $nb_occur = (int) $params['nb_occur'];
111
+        $is_limited = (bool)$params['is_limited'];
112
+        $nb_occur = (int)$params['nb_occur'];
113 113
         
114 114
         if ($is_limited) {
115 115
             if ($nb_occur > 0) {
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         
140 140
         FlashMessages::addMessage(I18N::translate('An error occured while updating the scheduled task'), 'danger');
141 141
         //@phpcs:ignore Generic.Files.LineLength.TooLong
142
-        Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” could not be updated. See error log.');
142
+        Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” could not be updated. See error log.');
143 143
         return false;
144 144
     }
145 145
     
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
                 'danger'
168 168
             );
169 169
             //phpcs:ignore Generic.Files.LineLength.TooLong
170
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : AdminTask “' . $task->name() . '” specific settings could not be updated. See error log.');
170
+            Log::addConfigurationLog('Module '.$this->module->title().' : AdminTask “'.$task->name().'” specific settings could not be updated. See error log.');
171 171
         }
172 172
         
173 173
         return true;
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 view($this->module->name() . '::tasks/healthcheck/config', [
194
+        return 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/AdminTasksModule.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     //How to update the database schema for this module
52 52
     private const SCHEMA_TARGET_VERSION   = 2;
53 53
     private const SCHEMA_SETTING_NAME     = 'MAJ_ADMTASKS_SCHEMA_VERSION';
54
-    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
54
+    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__.'\Schema';
55 55
 
56 56
     /**
57 57
      * {@inheritDoc}
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function loadRoutes(Map $router): void
93 93
     {
94
-        $router->attach('', '', static function (Map $router) {
94
+        $router->attach('', '', static function(Map $router) {
95 95
 
96
-            $router->attach('', '/module-maj/admintasks', static function (Map $router) {
96
+            $router->attach('', '/module-maj/admintasks', static function(Map $router) {
97 97
 
98
-                $router->attach('', '/admin', static function (Map $router) {
98
+                $router->attach('', '/admin', static function(Map $router) {
99 99
 
100 100
                     $router->extras([
101 101
                         'middleware' => [
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
                     ]);
105 105
                     $router->get(AdminConfigPage::class, '/config', AdminConfigPage::class);
106 106
                     
107
-                    $router->attach('', '/tasks', static function (Map $router) {
107
+                    $router->attach('', '/tasks', static function(Map $router) {
108 108
 
109 109
                         $router->get(TasksList::class, '', TasksList::class);
110 110
                         $router->get(TaskEditPage::class, '/{task}', TaskEditPage::class);
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     {
149 149
         $parameters['url'] = route(TaskTrigger::class);
150 150
         
151
-        return view($this->name() . '::snippet', $parameters);
151
+        return view($this->name().'::snippet', $parameters);
152 152
     }
153 153
     
154 154
     /**
Please login to merge, or discard this patch.
src/Webtrees/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()->nullable(false);
Please login to merge, or discard this patch.
src/Webtrees/Module/WelcomeBlock/Services/MatomoStatsService.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
         assert($cache instanceof Cache);
45 45
         
46 46
         return $cache->remember(
47
-            $module->name() . '-matomovisits-yearly-' . $block_id,
48
-            function () use ($module, $block_id): ?int {
47
+            $module->name().'-matomovisits-yearly-'.$block_id,
48
+            function() use ($module, $block_id): ?int {
49 49
                 $visits_year = $this->visits($module, $block_id, 'year');
50 50
                 if ($visits_year === null) {
51 51
                     return null;
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
     public function visitsToday(WelcomeBlockModule $module, int $block_id): ?int
69 69
     {
70 70
         return app('cache.array')->remember(
71
-            $module->name() . '-matomovisits-daily-' . $block_id,
72
-            function () use ($module, $block_id): ?int {
71
+            $module->name().'-matomovisits-daily-'.$block_id,
72
+            function() use ($module, $block_id) : ?int {
73 73
                 return $this->visits($module, $block_id, 'day');
74 74
             }
75 75
         );
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                 ]);
112 112
                 
113 113
                 if ($response->getStatusCode() === StatusCodeInterface::STATUS_OK) {
114
-                    $result = json_decode((string) $response->getBody(), true)['value'] ?? null;
114
+                    $result = json_decode((string)$response->getBody(), true)['value'] ?? null;
115 115
                     if ($result !== null) {
116 116
                         return (int)$result;
117 117
                     }
Please login to merge, or discard this patch.
src/Webtrees/Module/WelcomeBlock/WelcomeBlockModule.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function loadRoutes(Map $router): void
59 59
     {
60
-        $router->attach('', '', static function (Map $router) {
60
+        $router->attach('', '', static function(Map $router) {
61 61
 
62
-            $router->attach('', '/module-maj/welcomeblock/{block_id}', static function (Map $router) {
62
+            $router->attach('', '/module-maj/welcomeblock/{block_id}', static function(Map $router) {
63 63
                 
64 64
                 $router->get(MatomoStats::class, '/matomostats', MatomoStats::class);
65 65
             });
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $fab_login_block_view = app(\Fisharebest\Webtrees\Module\LoginBlockModule::class)
79 79
             ->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED);
80 80
         
81
-        $content = view($this->name() . '::block-embed', [
81
+        $content = view($this->name().'::block-embed', [
82 82
             'block_id'                  =>  $block_id,
83 83
             'fab_welcome_block_view'    =>  $fab_welcome_block_view,
84 84
             'fab_login_block_view'      =>  $fab_login_block_view,
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function editBlockConfiguration(Tree $tree, int $block_id): string
115 115
     {
116
-        return view($this->name() . '::config', $this->matomoSettings($block_id));
116
+        return view($this->name().'::config', $this->matomoSettings($block_id));
117 117
     }
118 118
     
119 119
     /**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function saveBlockConfiguration(ServerRequestInterface $request, int $block_id): void
124 124
     {
125
-        $params = (array) $request->getParsedBody();
125
+        $params = (array)$request->getParsedBody();
126 126
         
127 127
         $matomo_enabled = $params['matomo_enabled'] == 'yes';
128 128
         $this->setBlockSetting($block_id, 'matomo_enabled', $matomo_enabled ? 'yes' : 'no');
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             ->setBlockSetting($block_id, 'matomo_token', trim($params['matomo_token']))
146 146
             ->setBlockSetting($block_id, 'matomo_siteid', $params['matomo_siteid']);
147 147
         
148
-        app('cache.files')->forget($this->name() . '-matomovisits-yearly-' . $block_id);
148
+        app('cache.files')->forget($this->name().'-matomovisits-yearly-'.$block_id);
149 149
     }
150 150
     
151 151
     /**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
             'matomo_enabled' => $this->isMatomoEnabled($block_id),
172 172
             'matomo_url' => $this->getBlockSetting($block_id, 'matomo_url'),
173 173
             'matomo_token' => $this->getBlockSetting($block_id, 'matomo_token'),
174
-            'matomo_siteid'  => (int) $this->getBlockSetting($block_id, 'matomo_siteid', '0')
174
+            'matomo_siteid'  => (int)$this->getBlockSetting($block_id, 'matomo_siteid', '0')
175 175
         ];
176 176
     }
177 177
 }
Please login to merge, or discard this patch.