Passed
Push — feature/code-analysis ( 4fe35d...c99b5b )
by Jonathan
11:08 queued 07:29
created
app/Module/AdminTasks/Tasks/HealthCheckEmailTask.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 
114 114
         // Compute the number of days to compute
115 115
         $interval_lastrun =
116
-            Registry::timestampFactory()->now()->timestamp() -  $task_schedule->lastRunTime()->timestamp();
116
+            Registry::timestampFactory()->now()->timestamp() - $task_schedule->lastRunTime()->timestamp();
117 117
         $task_freq_seconds = 60 * $task_schedule->frequency();
118 118
         $interval = $interval_lastrun > $task_freq_seconds ? $interval_lastrun : $task_freq_seconds;
119
-        $nb_days = (int) CarbonInterval::seconds($interval)->ceilDay()->totalDays;
119
+        $nb_days = (int)CarbonInterval::seconds($interval)->ceilDay()->totalDays;
120 120
 
121 121
         $view_params_site = [
122 122
             'nb_days'               =>  $nb_days,
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                 continue;
136 136
             }
137 137
 
138
-            $webmaster = $this->user_service->find((int) $tree->getPreference('WEBMASTER_USER_ID'));
138
+            $webmaster = $this->user_service->find((int)$tree->getPreference('WEBMASTER_USER_ID'));
139 139
             if ($webmaster === null) {
140 140
                 continue;
141 141
             }
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
                 new TreeUser($tree),
157 157
                 $webmaster,
158 158
                 new NoReplyUser(),
159
-                I18N::translate('Health Check Report') . ' - ' . I18N::translate('Tree %s', $tree->name()),
160
-                view($this->module->name() . '::tasks/healthcheck/email-healthcheck-text', $view_params),
161
-                view($this->module->name() . '::tasks/healthcheck/email-healthcheck-html', $view_params)
159
+                I18N::translate('Health Check Report').' - '.I18N::translate('Tree %s', $tree->name()),
160
+                view($this->module->name().'::tasks/healthcheck/email-healthcheck-text', $view_params),
161
+                view($this->module->name().'::tasks/healthcheck/email-healthcheck-html', $view_params)
162 162
             );
163 163
         }
164 164
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function configView(ServerRequestInterface $request): string
173 173
     {
174
-        return $this->module === null ? '' : view($this->module->name() . '::tasks/healthcheck/config', [
174
+        return $this->module === null ? '' : view($this->module->name().'::tasks/healthcheck/config', [
175 175
             'all_trees'     =>  $this->tree_service->all()
176 176
         ]);
177 177
     }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
             foreach ($this->tree_service->all() as $tree) {
189 189
                 if (Auth::isManager($tree)) {
190
-                    $tree_enabled = $validator->boolean('HEALTHCHECK_ENABLED_' . $tree->id(), false);
190
+                    $tree_enabled = $validator->boolean('HEALTHCHECK_ENABLED_'.$tree->id(), false);
191 191
                     $tree->setPreference(self::TREE_PREFERENCE_NAME, $tree_enabled ? '1' : '0');
192 192
                 }
193 193
             }
Please login to merge, or discard this patch.
app/Module/AdminTasks/Services/TaskScheduleService.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     {
102 102
         return Registry::cache()->array()->remember(
103 103
             'maj-available-admintasks',
104
-            function (): Collection {
104
+            function(): Collection {
105 105
                 /** @var Collection<string, string> $tasks */
106 106
                 $tasks = $this->module_service
107 107
                     ->findByInterface(ModuleTasksProviderInterface::class)
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         $query = DB::table('maj_admintasks')
207 207
             ->select()
208 208
             ->where('majat_status', '=', 'enabled')
209
-            ->where(function (Builder $query): void {
209
+            ->where(function(Builder $query): void {
210 210
 
211 211
                 $query->where('majat_running', '=', 0)
212 212
                 ->orWhere(
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             });
218 218
 
219 219
         if (!$force) {
220
-            $query->where(function (Builder $query): void {
220
+            $query->where(function(Builder $query): void {
221 221
 
222 222
                 $query->where('majat_running', '=', 0)
223 223
                     ->orWhereRaw('DATE_ADD(majat_last_run, INTERVAL majat_frequency MINUTE) <= NOW()');
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
                     $task_schedule->setLastResult($task->run($task_schedule));
270 270
                 } catch (Throwable $ex) {
271 271
                     if ($first_error) { // Only record the first error, as this could fill the log.
272
-                        Log::addErrorLog(I18N::translate('Error while running task %s:', $task->name()) . ' ' .
273
-                            '[' . get_class($ex) . '] ' . $ex->getMessage() . ' ' . $ex->getFile() . ':'
274
-                            . $ex->getLine() . PHP_EOL . $ex->getTraceAsString());
272
+                        Log::addErrorLog(I18N::translate('Error while running task %s:', $task->name()).' '.
273
+                            '['.get_class($ex).'] '.$ex->getMessage().' '.$ex->getFile().':'
274
+                            . $ex->getLine().PHP_EOL.$ex->getTraceAsString());
275 275
                     }
276 276
                 }
277 277
 
@@ -292,17 +292,17 @@  discard block
 block discarded – undo
292 292
      */
293 293
     public static function rowMapper(): Closure
294 294
     {
295
-        return static function (stdClass $row): TaskSchedule {
295
+        return static function(stdClass $row): TaskSchedule {
296 296
 
297 297
             return new TaskSchedule(
298
-                (int) $row->majat_id,
298
+                (int)$row->majat_id,
299 299
                 $row->majat_task_id,
300 300
                 $row->majat_status === 'enabled',
301 301
                 Registry::timestampFactory()->fromString($row->majat_last_run),
302
-                (bool) $row->majat_last_result,
303
-                (int) $row->majat_frequency,
304
-                (int) $row->majat_nb_occur,
305
-                (bool) $row->majat_running
302
+                (bool)$row->majat_last_result,
303
+                (int)$row->majat_frequency,
304
+                (int)$row->majat_nb_occur,
305
+                (bool)$row->majat_running
306 306
             );
307 307
         };
308 308
     }
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Views/GeoAnalysisMap.php 1 patch
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function icon(ModuleInterface $module): string
47 47
     {
48
-        return view($module->name() . '::icons/view-map', ['type' => $this->type()]);
48
+        return view($module->name().'::icons/view-map', ['type' => $this->type()]);
49 49
     }
50 50
 
51 51
     /**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function globalSettingsContent(ModuleInterface $module): string
56 56
     {
57
-        return view($module->name() . '::admin/view-edit-map', [
57
+        return view($module->name().'::admin/view-edit-map', [
58 58
             'module_name'   =>  $module->name(),
59 59
             'view'          =>  $this,
60 60
             'colors'        =>  $this->colors(),
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
     {
72 72
         $default_color  = Validator::parsedBody($request)->string('view_map_color_default', '');
73 73
         $stroke_color   = Validator::parsedBody($request)->string('view_map_color_stroke', '');
74
-        $maxvalue_color  = Validator::parsedBody($request)->string('view_map_color_maxvalue', '');
75
-        $hover_color  = Validator::parsedBody($request)->string('view_map_color_hover', '');
74
+        $maxvalue_color = Validator::parsedBody($request)->string('view_map_color_maxvalue', '');
75
+        $hover_color = Validator::parsedBody($request)->string('view_map_color_hover', '');
76 76
 
77 77
         try {
78 78
             return $this->withColors(new MapColorsConfig(
@@ -99,17 +99,16 @@  discard block
 block discarded – undo
99 99
         foreach ($map_adapters as $map_adapter) {
100 100
             $adapter_result_tmp = $map_adapter->convert($result);
101 101
             $adapter_result = $adapter_result === null ?
102
-                $adapter_result_tmp :
103
-                $adapter_result->merge($adapter_result_tmp);
102
+                $adapter_result_tmp : $adapter_result->merge($adapter_result_tmp);
104 103
         }
105 104
 
106 105
         if ($adapter_result === null) {
107
-            return view($module->name() . '::errors/tab-error', [
106
+            return view($module->name().'::errors/tab-error', [
108 107
                 'message'   =>  I18N::translate('The map could not be loaded.'),
109 108
             ]);
110 109
         }
111 110
 
112
-        return view($module->name() . '::geoanalysisview-tab-glb-map', $params + [
111
+        return view($module->name().'::geoanalysisview-tab-glb-map', $params + [
113 112
             'result'            =>  $adapter_result->geoAnalysisResult(),
114 113
             'features'          =>  $adapter_result->features(),
115 114
             'colors'            =>  $this->colors(),
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Schema/Migration1.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $in_transaction = DB::connection()->getPdo()->inTransaction();
33 33
 
34
-        DB::schema()->create('maj_geodisp_views', static function (Blueprint $table): void {
34
+        DB::schema()->create('maj_geodisp_views', static function(Blueprint $table): void {
35 35
             $table->integer('majgv_id')->autoIncrement();
36 36
             $table->integer('majgv_gedcom_id')->index();
37 37
             $table->string('majgv_view_class', 255);
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
             $table->foreign('majgv_gedcom_id')->references('gedcom_id')->on('gedcom')->onDelete('cascade');
46 46
         });
47 47
 
48
-        DB::schema()->create('maj_geodisp_mapviews', static function (Blueprint $table): void {
48
+        DB::schema()->create('maj_geodisp_mapviews', static function(Blueprint $table): void {
49 49
             $table->integer('majgm_id')->autoIncrement();
50 50
             $table->integer('majgm_majgv_id')->index();
51 51
             $table->string('majgm_map_id', 127);
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewEditAction.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -104,14 +104,14 @@
 block discarded – undo
104 104
                 'success'
105 105
             );
106 106
             //phpcs:ignore Generic.Files.LineLength.TooLong
107
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.');
107
+            Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” has been updated.');
108 108
         } catch (Throwable $ex) {
109 109
             FlashMessages::addMessage(
110 110
                 I18N::translate('An error occured while updating the geographical dispersion analysis view.'),
111 111
                 'danger'
112 112
             );
113 113
             //phpcs:ignore Generic.Files.LineLength.TooLong
114
-            Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage());
114
+            Log::addErrorLog('Module '.$this->module->title().' : Error when updating view “'.$view->id().'”: '.$ex->getMessage());
115 115
         }
116 116
 
117 117
         return redirect($admin_config_route);
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewAddPage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
         }
69 69
         $tree = Validator::attributes($request)->tree();
70 70
 
71
-        return $this->viewResponse($this->module->name() . '::admin/view-add', [
71
+        return $this->viewResponse($this->module->name().'::admin/view-add', [
72 72
             'module'        =>  $this->module,
73 73
             'title'         =>  I18N::translate('Add a geographical dispersion analysis view'),
74 74
             'tree'          =>  $tree,
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/MapAdapterEditAction.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $map_adapter = $this->mapadapter_data_service->find($adapter_id);
77 77
 
78 78
         $map = $this->map_definition_service->find(Validator::parsedBody($request)->string('map_adapter_map', ''));
79
-        $mapping_property   = Validator::parsedBody($request)->string('map_adapter_property_selected', '');
79
+        $mapping_property = Validator::parsedBody($request)->string('map_adapter_property_selected', '');
80 80
 
81 81
         $mapper = null;
82 82
         try {
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
                 'success'
102 102
             );
103 103
             //phpcs:ignore Generic.Files.LineLength.TooLong
104
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been updated.');
104
+            Log::addConfigurationLog('Module '.$this->module->title().' : Map Adapter “'.$map_adapter->id().'” has been updated.');
105 105
         } catch (Throwable $ex) {
106 106
             FlashMessages::addMessage(
107 107
                 I18N::translate('An error occured while updating the map configuration.'),
108 108
                 'danger'
109 109
             );
110 110
             //phpcs:ignore Generic.Files.LineLength.TooLong
111
-            Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating Map Adapter “' . $map_adapter->id() . '”: ' . $ex->getMessage());
111
+            Log::addErrorLog('Module '.$this->module->title().' : Error when updating Map Adapter “'.$map_adapter->id().'”: '.$ex->getMessage());
112 112
         }
113 113
 
114 114
         return redirect(route(GeoAnalysisViewEditPage::class, [
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewListData.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $module_name = $this->module->name();
67 67
         return response(['data' => $this->geoview_data_service->all($tree, true)
68 68
             ->map(fn(AbstractGeoAnalysisView $view) => [
69
-                'edit' => view($module_name . '::admin/view-table-options', [
69
+                'edit' => view($module_name.'::admin/view-table-options', [
70 70
                     'view_id' => $view->id(),
71 71
                     'view_enabled' => $view->isEnabled(),
72 72
                     'view_edit_route' => route(GeoAnalysisViewEditPage::class, [
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
                     ]),
85 85
                 ]),
86 86
                 'enabled' =>  [
87
-                    'display' => view($module_name . '::components/yes-no-icons', ['yes' => $view->isEnabled()]),
87
+                    'display' => view($module_name.'::components/yes-no-icons', ['yes' => $view->isEnabled()]),
88 88
                     'raw' => $view->isEnabled() ? 0 : 1
89 89
                 ],
90 90
                 'type' =>  $view->icon($module),
91 91
                 'description' => [
92
-                    'display' => '<bdi>' . e($view->description()) . '</bdi>',
92
+                    'display' => '<bdi>'.e($view->description()).'</bdi>',
93 93
                     'raw' => e($view->description())
94 94
                 ],
95 95
                 'analysis' => [
96
-                    'display' => '<bdi>' . e($view->analysis()->title()) . '</bdi>',
96
+                    'display' => '<bdi>'.e($view->analysis()->title()).'</bdi>',
97 97
                     'raw' => e($view->analysis()->title())
98 98
                 ],
99 99
                 'place_depth' => [
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/MapAdapterEditPage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
83 83
             );
84 84
         }
85 85
 
86
-        return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [
86
+        return $this->viewResponse($this->module->name().'::admin/map-adapter-edit', [
87 87
             'module'            =>  $this->module,
88 88
             'title'             =>  I18N::translate('Edit the map configuration'),
89 89
             'tree'              =>  $tree,
Please login to merge, or discard this patch.